Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

exec(<string>, closure=<non-None>) failed assertion #130070

Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump
@johnslavik

Description

@johnslavik

Crash report

What happened?

Minimal repro:

print("Reproducing!")exec("",closure=object())

Fails with

Reproducing!python: Python/ast.c:1047: _PyAST_Validate: Assertion `!PyErr_Occurred()' failed.Aborted (core dumped)

Note the error occurs not because the passedclosure= is incorrect (it should be a tuple of cell objects), but becauseclosure= is not allowed when string is the source.

The reason for that to happen is a missinggoto error jump:

if (closure!=NULL) {
PyErr_SetString(PyExc_TypeError,
"closure can only be used when source is a code object");
}

causing the rest of the code to execute and reach_PyAST_Validate.

In the PR, I included the missing test case.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

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

Python 3.14.0a5+ (heads/main-dirty:f9a7d41bacb, Feb 13 2025, 04:52:15) [GCC 11.4.0]

Linked PRs

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp