Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Crash with locals() used in list comprehension  #130451

Closed as duplicate of#128396
Closed as duplicate of#128396
@barry-scott

Description

@barry-scott

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)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-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