Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lang] Cancel deprecating native min/max #7928

Merged
merged 1 commit into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions python/taichi/lang/ast/ast_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,6 @@ def build_call_if_is_builtin(ctx, node, args, keywords):

if id(func) in replace_func:
node.ptr = replace_func[id(func)](*args, **keywords)
if func is min or func is max:
name = "min" if func is min else "max"
warnings.warn_explicit(
f'Calling builtin function "{name}" in Taichi scope is deprecated, '
f"and it will be removed in Taichi v1.6.0."
f'Please use "ti.{name}" instead.',
DeprecationWarning,
ctx.file,
node.lineno + ctx.lineno_offset,
module="taichi",
)
return True
return False

Expand Down
15 changes: 0 additions & 15 deletions tests/python/test_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,6 @@ def test_deprecate_rwtexture_ndim():
ti.graph.Arg(ti.graph.ArgKind.RWTEXTURE, "x", shape=(128, 128), fmt=ti.Format.r32f)


@test_utils.test()
def test_deprecate_builtin_min_max():
with pytest.warns(
DeprecationWarning,
match='Calling builtin function "max" in Taichi scope is deprecated, '
"and it will be removed in Taichi v1.6.0.",
):

@ti.kernel
def func():
max(1, 2)

func()


@test_utils.test()
def test_deprecate_is_is_not():
with pytest.warns(
Expand Down
4 changes: 1 addition & 3 deletions tests/python/test_native_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ def func():
y[i] = N - i
z[i] = i - 2 if i % 2 else i + 2

with pytest.warns(DeprecationWarning, match="Calling builtin function") as records:
func()
assert len(records) > 0
func()

assert np.allclose(
minimum.to_numpy(),
Expand Down