Skip to content

SystemError: compiler_lookup_arg(name='name_1') with reftype=7 failed in <genexpr> #132479

@15r10nk

Description

@15r10nk

Crash report

What happened?

I found the following issue by fuzzing with pysource-codegen.

This script failed to compile the given code to bytecode:

code="""
(name_3): name_5
name_4: (
    name_4
    async for (
        name_5
        for something in name_1
        async for () in (name_0 async for name_5 in name_0 for name_0 in name_1)
    ).name_3 in {name_5: name_5 for name_1 in name_4}
)
"""
compile(code,"<file>","exec")

running it with cpython results in the following error:

Traceback (most recent call last):
  File "/home/frank/projects/cpython/../pysource-playground/bug.py", line 12, in <module>
    compile(code,"<file>","exec")
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
SystemError: compiler_lookup_arg(name='name_1') with reftype=7 failed in <genexpr>; freevars of code <genexpr>: ('name_1',)

I bisected the problem down to 9b8611e @JelleZijlstra do you want to take a look at it?

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.14.0a0 (bisect/bad:9b8611eeea1, Apr 13 2025, 17:20:02) [GCC 12.2.0]

Linked PRs

Metadata

Metadata

Assignees

Labels

3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions