diff options
author | kj <28750310+Fidget-Spinner@users.noreply.github.com> | 2020-12-05 16:02:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-05 16:02:14 (GMT) |
commit | 804d6893b801e8f30318afc38c20d4d0e6161db3 (patch) | |
tree | 54ab5cd365ec99fa0cd95cb690bb9ef3d02f9658 /Lib | |
parent | da3d2abe6be9fcf18cac12ec5d7d9f1180d94b5e (diff) | |
download | cpython-804d6893b801e8f30318afc38c20d4d0e6161db3.zip cpython-804d6893b801e8f30318afc38c20d4d0e6161db3.tar.gz cpython-804d6893b801e8f30318afc38c20d4d0e6161db3.tar.bz2 |
bpo-42576: Raise TypeError when passing in keyword arguments to GenericAlias (GH-23656)
Use `_PyArg_NoKeywords` instead of `_PyArg_NoKwnames` when checking the `kwds` tuple when creating `GenericAlias`. This fixes an interpreter crash when passing in keyword arguments to `GenericAlias`'s constructor.
Needs backport to 3.9.
Automerge-Triggered-By: GH:gvanrossum
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_genericalias.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py index 912fb33..c113e53 100644 --- a/Lib/test/test_genericalias.py +++ b/Lib/test/test_genericalias.py @@ -302,6 +302,11 @@ class BaseTest(unittest.TestCase): alias = t[int] self.assertEqual(ref(alias)(), alias) + def test_no_kwargs(self): + # bpo-42576 + with self.assertRaises(TypeError): + GenericAlias(bad=float) + if __name__ == "__main__": unittest.main() |