File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 55from ._array_object import Array
66from ._dtypes import _real_numeric_dtypes , _result_type
77from ._dtypes import bool as _bool
8- from ._flags import requires_api_version , requires_data_dependent_shapes
8+ from ._flags import requires_api_version , requires_data_dependent_shapes , get_array_api_strict_flags
99from ._helpers import _maybe_normalize_py_scalars
1010
1111
@@ -64,7 +64,7 @@ def count_nonzero(
6464@requires_api_version ('2023.12' )
6565def searchsorted (
6666 x1 : Array ,
67- x2 : Array ,
67+ x2 : Array | int | float ,
6868 / ,
6969 * ,
7070 side : Literal ["left" , "right" ] = "left" ,
@@ -75,6 +75,12 @@ def searchsorted(
7575
7676 See its docstring for more information.
7777 """
78+ flags = get_array_api_strict_flags ()
79+ if flags ["api_version" ] >= "2025.12" :
80+
81+ if isinstance (x2 , bool | int | float | complex ):
82+ x2 = x1 ._promote_scalar (x2 )
83+
7884 if x1 .dtype not in _real_numeric_dtypes or x2 .dtype not in _real_numeric_dtypes :
7985 raise TypeError ("Only real numeric dtypes are allowed in searchsorted" )
8086
You can’t perform that action at this time.
0 commit comments