diff options
author | zq1997 <email2zq@qq.com> | 2022-01-17 17:45:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-17 17:45:44 (GMT) |
commit | c118c2455c95baea08045dc64963600b7a56b6fd (patch) | |
tree | 123654926c6f7000d497917ed1dd38374f8407a1 /Lib/test | |
parent | 62a6594e66ca955073be2f4e5a40291a39252ef3 (diff) | |
download | cpython-c118c2455c95baea08045dc64963600b7a56b6fd.zip cpython-c118c2455c95baea08045dc64963600b7a56b6fd.tar.gz cpython-c118c2455c95baea08045dc64963600b7a56b6fd.tar.bz2 |
bpo-46161: Fix bug in starunpack_helper in compile.c (GH-30235)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_class.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py index 7524f58..7cf5e06 100644 --- a/Lib/test/test_class.py +++ b/Lib/test/test_class.py @@ -666,5 +666,23 @@ class ClassTests(unittest.TestCase): with self.assertRaisesRegex(TypeError, error_msg): object.__init__(E(), 42) + def testClassWithExtCall(self): + class Meta(int): + def __init__(*args, **kwargs): + pass + + def __new__(cls, name, bases, attrs, **kwargs): + return bases, kwargs + + d = {'metaclass': Meta} + + class A(**d): pass + self.assertEqual(A, ((), {})) + class A(0, 1, 2, 3, 4, 5, 6, 7, **d): pass + self.assertEqual(A, (tuple(range(8)), {})) + class A(0, *range(1, 8), **d, foo='bar'): pass + self.assertEqual(A, (tuple(range(8)), {'foo': 'bar'})) + + if __name__ == '__main__': unittest.main() |