File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 17
17
DType = _GenericAlias (np .dtype , (ScalarType ,))
18
18
NDArray = _GenericAlias (np .ndarray , (Any , DType ))
19
19
20
+ # NOTE: The `npt._GenericAlias` *class* isn't quite stable on python >=3.11.
21
+ # This is not a problem during runtime (as it's 3.8-exclusive), but we still
22
+ # need it for the >=3.9 in order to verify its semantics match
23
+ # `types.GenericAlias` replacement. xref numpy/numpy#21526
20
24
if sys .version_info >= (3 , 9 ):
21
25
DType_ref = types .GenericAlias (np .dtype , (ScalarType ,))
22
26
NDArray_ref = types .GenericAlias (np .ndarray , (Any , DType_ref ))
23
- FuncType = Callable [[Union [ _GenericAlias , types .GenericAlias ] ], Any ]
27
+ FuncType = Callable [[" _GenericAlias | types.GenericAlias" ], Any ]
24
28
else :
25
29
DType_ref = Any
26
30
NDArray_ref = Any
27
- FuncType = Callable [[_GenericAlias ], Any ]
31
+ FuncType = Callable [[" _GenericAlias" ], Any ]
28
32
29
33
GETATTR_NAMES = sorted (set (dir (np .ndarray )) - _GenericAlias ._ATTR_EXCEPTIONS )
30
34
You can’t perform that action at this time.
0 commit comments