Skip to content

Crash with locals() used in list comprehension #130451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
barry-scott opened this issue Feb 22, 2025 · 3 comments
Closed

Crash with locals() used in list comprehension #130451

barry-scott opened this issue Feb 22, 2025 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@barry-scott
Copy link
Contributor

barry-scott commented Feb 22, 2025

Crash report

What happened?

def f():
    lambda: k
    k = 1
    print([locals() for k in [0]])

f()

Was reported on https://discuss.python.org/t/segfault-in-calling-locals-within-list-comprehension/81681
Tested on macOS and Fedora 41.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

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

Python 3.13.0 (v3.13.0:60403a5409f, Oct 7 2024, 00:37:40) [Clang 15.0.0 (clang-1500.3.9.4)]

@barry-scott barry-scott added the type-crash A hard crash of the interpreter, possibly with a core dump label Feb 22, 2025
@picnixz picnixz added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Feb 22, 2025
@picnixz
Copy link
Member

picnixz commented Feb 22, 2025

cc @carljm (not sure if it wasn't already a known issue)

@picnixz picnixz changed the title segv with locals() using in list comprehension PyCell_Check() assertion fails with locals() used in list comprehension Feb 22, 2025
@sergey-miryanov
Copy link
Contributor

It seems to be fixed #130235

@picnixz
Copy link
Member

picnixz commented Feb 22, 2025

Actually, it seems to have been solved. The PyCell_Check assertion failed because of something else I think.

@picnixz picnixz closed this as completed Feb 22, 2025
@picnixz picnixz changed the title PyCell_Check() assertion fails with locals() used in list comprehension Crash with locals() used in list comprehension Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

3 participants