Skip to content

Commit c70e82e

Browse files
committed
Add a simple test case.
1 parent 9458120 commit c70e82e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Lib/test/test_typing.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5844,6 +5844,21 @@ class A:
58445844
with self.assertRaises(TypeError):
58455845
a[int]
58465846

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()
5858+
type type_alias[*_] = 0
5859+
with self.assertRaises(TypeError):
5860+
type_alias[evil][0]
5861+
58475862

58485863
class ClassVarTests(BaseTestCase):
58495864

0 commit comments

Comments
 (0)