[New-bugs-announce] [issue42576] Passing keyword arguments to types.GenericAlias causes a hard crash
Ken Jin
report at bugs.python.org
Sat Dec 5 09:31:19 EST 2020
New submission from Ken Jin <kenjin4096 at gmail.com>:
I noticed that passing keyword arguments to types.GenericAlias's __new__ causes the interpreter to hard crash and exit due to an assertion failure:
import types
types.GenericAlias(bad=float)
Result:
Assertion failed: PyTuple_CheckExact(kwnames), file ....\cpython\Python\getargs.c, line 2767
A simple fix is to just use _PyArg_NoKeywords instead of _PyArg_NoKwnames.
Looking through the rest of the C code, it seems that apart from GenericAlias, only vectorcalls for various builtins use _PyArg_NoKwnames. However, they don't seem to be affected by the bug.
----------
components: Interpreter Core
messages: 382565
nosy: gvanrossum, kj
priority: normal
severity: normal
status: open
title: Passing keyword arguments to types.GenericAlias causes a hard crash
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42576>
_______________________________________
More information about the New-bugs-announce
mailing list