Skip to content

Commit

Permalink
[Error] Remove deprecated a.atomic_op(b) in Taichi v1.6.0 (#7225)
Browse files Browse the repository at this point in the history
Issue: #7189 

### Brief Summary
  • Loading branch information
lin-hitonami authored Jan 20, 2023
1 parent 05e152c commit d104739
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/taichi/lang/common_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TaichiOperations:
def __getattr__(self, item):
if item in TaichiOperations.__deprecated_atomic_ops__:
warnings.warn(
f"a.{item}(b) is deprecated. Please use ti.{item}(a, b) instead.",
f"a.{item}(b) is deprecated, and it will be removed in Taichi v1.6.0. Please use ti.{item}(a, b) instead.",
DeprecationWarning)
return getattr(self,
TaichiOperations.__deprecated_atomic_ops__[item])
Expand Down
16 changes: 16 additions & 0 deletions tests/python/test_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@
from tests import test_utils


@test_utils.test()
def test_deprecate_a_atomic_b():
with pytest.warns(
DeprecationWarning,
match=
r"a\.atomic_add\(b\) is deprecated, and it will be removed in Taichi v1.6.0."
):

@ti.kernel
def func():
a = 1
a.atomic_add(2)

func()


@test_utils.test()
def test_deprecate_element_shape_ndarray_annotation():
with pytest.warns(
Expand Down

0 comments on commit d104739

Please sign in to comment.