Bug report
Bug description:
The following code causes a SystemError during compilation.
classname_2[*name_5, name_3: int]:
(name_3:=name_4)
classname_4[name_5: name_5]((name_4forname_5inname_0ifname_3), name_2ifname_3elsename_0):
pass
output (Python 3.12.0rc2+):
SystemError: compiler_lookup_arg(name='name_3') withreftype=3failedin<genericparametersofname_4>; freevarsofcode<genexpr>: ('name_3',)removing the named-expression makes it worse and causes a crash
classname_2[*name_5, name_3: int]:
classname_4[name_5: name_5]((name_4forname_5inname_0ifname_3), name_2ifname_3elsename_0):
pass
output (Python 3.12.0rc2+):
Traceback (mostrecentcalllast):
File"/home/frank/projects/pysource-codegen/bug2.py", line2, in<module>classname_2[*name_5, name_3: int]:
File"/home/frank/projects/pysource-codegen/bug2.py", line2, in<genericparametersofname_2>classname_2[*name_5, name_3: int]:
File"/home/frank/projects/pysource-codegen/bug2.py", line4, inname_2classname_4[name_5: name_5]((name_4forname_5inname_0ifname_3), name_2ifname_3elsename_0):
File"/home/frank/projects/pysource-codegen/bug2.py", line4, in<genericparametersofname_4>classname_4[name_5: name_5]((name_4forname_5inname_0ifname_3), name_2ifname_3elsename_0):
^^^^^^NameError: name'name_0'isnotdefinedModules/gcmodule.c:113: gc_decref: Assertion"gc_get_refs(g) > 0"failed: refcountistoosmallEnabletracemalloctogetthememoryblockallocationtracebackobjectaddress : 0x7f4c77059a30objectrefcount : 1objecttype : 0x560ea4b6cfe0objecttypename: dictobjectrepr : {'__module__': '__main__', '__qualname__': 'name_2', '__type_params__': (name_5, name_3)}
FatalPythonerror: _PyObject_AssertFailed: _PyObject_AssertFailedPythonruntimestate: finalizing (tstate=0x0000560ea4cc9ba0)
Currentthread0x00007f4c7756c280 (mostrecentcallfirst):
Garbage-collecting<noPythonframe>side note:
The reason for the strange looking language constructs and variable names is that I generated this code. I found it while working on my pysource-codegen library.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
The following code causes a SystemError during compilation.
output (Python 3.12.0rc2+):
removing the named-expression makes it worse and causes a crash
output (Python 3.12.0rc2+):
side note:
The reason for the strange looking language constructs and variable names is that I generated this code. I found it while working on my pysource-codegen library.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs