From c36e98bb745f753b0bb213014fa3e0a279475640 Mon Sep 17 00:00:00 2001 From: Christian Bourjau Date: Wed, 4 Jun 2025 12:01:49 +0200 Subject: [PATCH] Avoid undefined behavior in asarray with very large intergers --- array_api_tests/test_operators_and_elementwise_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/array_api_tests/test_operators_and_elementwise_functions.py b/array_api_tests/test_operators_and_elementwise_functions.py index 7fefa151..84bcaa28 100644 --- a/array_api_tests/test_operators_and_elementwise_functions.py +++ b/array_api_tests/test_operators_and_elementwise_functions.py @@ -1000,8 +1000,8 @@ def test_clip(x, data): hh.arrays(dtype=st.just(x.dtype), shape=shape2), ), label="max") - # min > max is undefined (but allow nans) - assume(min is None or max is None or not xp.any(ah.less(xp.asarray(max), xp.asarray(min)))) + # Note1: min > max is undefined (but allow nans) + assume(min is None or max is None or not xp.any(ah.less(xp.asarray(max, dtype=x.dtype), xp.asarray(min, dtype=x.dtype)))) kw = data.draw( hh.specified_kwargs(