Skip to content
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

MAINT: Do not let _GenericAlias wrap the underlying classes' __class__ attribute #21982

Merged
merged 1 commit into from Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions numpy/_typing/_generic_alias.py
Expand Up @@ -216,6 +216,7 @@ def __iter__(self: _T) -> Generator[_T, None, None]:
"__deepcopy__",
"__unpacked__",
"__typing_unpacked_tuple_args__",
"__class__",
})

def __getattribute__(self, name: str) -> Any:
Expand Down
5 changes: 4 additions & 1 deletion numpy/typing/tests/test_generic_alias.py
Expand Up @@ -120,9 +120,12 @@ def test_dir(self) -> None:
# and they are thus now longer equivalent
("__ne__", lambda n: n != next(iter(n)), ("beta", 1)),

# >= beta3 stuff
# >= beta3
("__typing_unpacked_tuple_args__",
lambda n: n.__typing_unpacked_tuple_args__, ("beta", 3)),

# >= beta4
("__class__", lambda n: n.__class__ == type(n), ("beta", 4)),
])
def test_py311_features(
self,
Expand Down