Skip to content

Commit eea34e1

Browse files
BvB93charris
authored andcommittedJul 24, 2022
MAINT: Do not let _GenericAlias wrap the underlying classes __class__ attribute
Adapt to the 3.11b4 changes introduced in python/cpython#93754
1 parent 1cd77ce commit eea34e1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎numpy/_typing/_generic_alias.py

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def __iter__(self: _T) -> Generator[_T, None, None]:
216216
"__deepcopy__",
217217
"__unpacked__",
218218
"__typing_unpacked_tuple_args__",
219+
"__class__",
219220
})
220221

221222
def __getattribute__(self, name: str) -> Any:

‎numpy/typing/tests/test_generic_alias.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,12 @@ def test_dir(self) -> None:
120120
# and they are thus now longer equivalent
121121
("__ne__", lambda n: n != next(iter(n)), ("beta", 1)),
122122
123-
# >= beta3 stuff
123+
# >= beta3
124124
("__typing_unpacked_tuple_args__",
125125
lambda n: n.__typing_unpacked_tuple_args__, ("beta", 3)),
126+
127+
# >= beta4
128+
("__class__", lambda n: n.__class__ == type(n), ("beta", 4)),
126129
])
127130
def test_py311_features(
128131
self,

0 commit comments

Comments
 (0)