We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 761812d commit 46b6fa3Copy full SHA for 46b6fa3
Lib/test/test_typing.py
@@ -5847,14 +5847,14 @@ class A:
5847
def test_return_non_tuple_while_unpacking(self):
5848
# GH-138497: GenericAlias objects didn't ensure that __typing_subst__ actually
5849
# returned a tuple
5850
- class Generic:
5851
- def __call__(*_):
5852
- return None
5853
-
5854
- def __getattr__(self, _):
5855
- return Generic()
5856
5857
- evil = Generic()
+ class EvilTypeVar:
+ __typing_is_unpacked_typevartuple__ = True
+ def __typing_prepare_subst__(*_):
+ return None # any value
+ def __typing_subst__(*_):
+ return 42 # not tuple
+
+ evil = EvilTypeVar()
5858
type type_alias[*_] = 0
5859
with self.assertRaises(TypeError):
5860
type_alias[evil][0]
0 commit comments