Closed
Description
Bug report
Bug description:
The following script shows the SystemError:
class name_1[name_4]: class name_4[name_2](name_4): name_4
output (Python 3.12.0rc2+):
SystemError: compiler_lookup_arg(name='name_4') with reftype=3 failed in <generic parameters of name_4>; freevars of code name_4: ('.type_params', 'name_4')
minimizing it further leads some different crashes:
The propably most interresting one is this, which does not look special at all.
class name_1[name_3]: class name_4[name_2](name_5): pass
output (Python 3.12.0rc2+):
Traceback (most recent call last): File "/home/frank/projects/pysource-codegen/bug3.py", line 1, in <module> class name_1[name_3]: File "/home/frank/projects/pysource-codegen/bug3.py", line 1, in <generic parameters of name_1> class name_1[name_3]: File "/home/frank/projects/pysource-codegen/bug3.py", line 2, in name_1 class name_4[name_2](name_5): File "/home/frank/projects/pysource-codegen/bug3.py", line 2, in <generic parameters of name_4> class name_4[name_2](name_5): ^^^^^^ NameError: name 'name_5' is not defined. Did you mean: 'name_2'? Modules/gcmodule.c:113: gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small Enable tracemalloc to get the memory block allocation traceback object address : 0x7f2c57a12930 object refcount : 1 object type : 0x557ad9ef1fe0 object type name: dict object repr : {'__module__': '__main__', '__qualname__': 'name_1', '__type_params__': (name_3,)} Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed Python runtime state: finalizing (tstate=0x0000557ada04eba0) Current thread 0x00007f2c57f21280 (most recent call first): Garbage-collecting <no Python frame>
@JelleZijlstra I think this is another one for you. Feel free to create a second issue if you think that they are unrelated.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Done