From f2efce5873ae3b791ee11a12f3cc8d4831444cd1 Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Mon, 9 Feb 2026 17:43:58 +0100 Subject: [PATCH] BUG: clip: allow clip(float_array, min=int_scalar) Python integers can be promoted together with float arrays. --- array_api_strict/_elementwise_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/array_api_strict/_elementwise_functions.py b/array_api_strict/_elementwise_functions.py index 10c854e..dfd8960 100644 --- a/array_api_strict/_elementwise_functions.py +++ b/array_api_strict/_elementwise_functions.py @@ -278,8 +278,8 @@ def clip( isinstance(arg, Array) and arg.dtype in _real_floating_dtypes)): raise TypeError(f"{argname} must be integral when x is integral") if (x.dtype in _real_floating_dtypes - and (isinstance(arg, int) or - isinstance(arg, Array) and arg.dtype in _integer_dtypes)): + and (isinstance(arg, Array) and arg.dtype in _integer_dtypes) + ): raise TypeError(f"{arg} must be floating-point when x is floating-point") # Normalize to make the below logic simpler