You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note the error occurs not because the passed closure= is incorrect (it should be a tuple of cell objects), but because closure= is not allowed when string is the source.
The reason for that to happen is a missing goto error jump:
Unable to reproduce in 3.13 or main branch build with the supplied code:
Reproducing!
Traceback (most recent call last):
File "<python-input-0>", line 2, in <module>
exec("", closure=object())
~~~~^^^^^^^^^^^^^^^^^^^^^^
TypeError: closure can only be used when source is a code object
Activity
StanFromIreland commentedon Feb 13, 2025
Unable to reproduce in 3.13 or main branch build with the supplied code:
johnslavik commentedon Feb 13, 2025
Oh! This isn't a segfault. It says "aborted".
[-]`exec(<string>, closure=<non-None>)` segfaults[/-][+]`exec(<string>, closure=<non-None>)` failed assertion[/+]johnslavik commentedon Feb 13, 2025
@tomasr8 Should the label be changed to
type-bug? It's not a hard crash, just a subtle bug, even though a core dump is produced.encukou commentedon Feb 13, 2025
It crashes in debug builds.
gh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected path (#…
pythongh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected …
pythongh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected …
pythongh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected …
[3.13] gh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected…
Eclips4 commentedon Apr 17, 2025
Thank you Bartosz!