8000 TST,TYP: Fix a python 3.11 failure for the `GenericAlias` tests by BvB93 · Pull Request #21543 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TST,TYP: Fix a python 3.11 failure for the GenericAlias tests #21543

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

Merged
merged 2 commits into from
May 21, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
DOC: Add a note about npt._GenericAlias >=3.11 stability
  • Loading branch information
Bas van Beek committed May 20, 2022
commit 7c98e8c18c147bcbf6f9344376ca380a5d8f6c7b
4 changes: 4 additions & 0 deletions numpy/typing/tests/test_generic_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
DType = _GenericAlias(np.dtype, (ScalarType,))
NDArray = _GenericAlias(np.ndarray, (Any, DType))

# NOTE: The `npt._GenericAlias` *class* isn't quite stable on python >=3.11.
# This is not a problem during runtime (as it's 3.8-exclusive), but we still
# need it for the >=3.9 in order to verify its semantics match
# `types.GenericAlias` replacement. xref numpy/numpy#21526
if sys.version_info >= (3, 9):
DType_ref = types.GenericAlias(np.dtype, (ScalarType,))
NDArray_ref = types.GenericAlias(np.ndarray, (Any, DType_ref))
Expand Down
0