gh-130070: Fix exec(<string>, closure=<non-None>) unexpected path#130071
gh-130070: Fix exec(<string>, closure=<non-None>) unexpected path#130071Eclips4 merged 8 commits intopython:mainfrom
exec(<string>, closure=<non-None>) unexpected path#130071Conversation
exec(<string>, closure=<non-None>) segfaultexec(<string>, closure=<non-None>) segfault
sobolevn
left a comment
There was a problem hiding this comment.
Before:
» ./python.exe
Python 3.14.0a5+ (heads/main:625470a7d2c, Feb 13 2025, 10:38:58) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exec("", closure=object())
Assertion failed: (!PyErr_Occurred()), function _PyAST_Validate, file ast.c, line 1047.
[1] 91990 abort ./python.exe
After: all tests pass.
Do we need to backport this?
Misc/NEWS.d/next/Core_and_Builtins/2025-02-13-05-09-31.gh-issue-130070.C8c9gK.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: sobolevn <mail@sobolevn.me>
NVM, this issue seems to be specific to my debug build: #130070 (comment). |
exec(<string>, closure=<non-None>) segfaultexec(<string>, closure=<non-None>) unexpected path
|
Sorry, I'm still new to C 😅 This isn't a segfault, it's a fix for failed assertion. The program was stopped by the |
Misc/NEWS.d/next/Core_and_Builtins/2025-02-13-05-09-31.gh-issue-130070.C8c9gK.rst
Outdated
Show resolved
Hide resolved
|
I'd also change the branch name, but that would close the PR as a side effect |
I don't think that's needed, the branch name is usually not relevant :) |
|
I think we can backport this. |
Does it also crash on 3.12 and 3.13? If yes, let's backport it |
|
Reproduced on 3.12 and 3.13. Details❯ python -VV && python -c 'exec("", closure=object())'
Python 3.12.9+ (heads/3.12:0931693f95b, Feb 18 2025, 16:24:22) [GCC 11.4.0]
python: Python/ast.c:1044: _PyAST_Validate: Assertion `!PyErr_Occurred()' failed.
Aborted❯ python -VV && python -c 'exec("", closure=object())'
Python 3.13.2+ (heads/3.13:57e8b0cbee1, Feb 18 2025, 16:30:24) [GCC 11.4.0]
python: Python/ast.c:1049: _PyAST_Validate: Assertion `!PyErr_Occurred()' failed.
AbortedLet's backport! 🚀 |
|
Sorry, @bswck and @Eclips4, I could not cleanly backport this to |
|
@bswck Would you mind creating a manual backport for 3.13? :) |
|
Yes, sure! |
…path (python#130071) Fixed an assertion error (so, it could be reproduced only in builds with assertions enabled) for `exec` when the `source` argument is a string and the `closure` argument is not `None`. Co-authored-by: sobolevn <mail@sobolevn.me> (cherry picked from commit 954b2cf)
…path (python#130071) Fixed an assertion error (so, it could be reproduced only in builds with assertions enabled) for `exec` when the `source` argument is a string and the `closure` argument is not `None`. Co-authored-by: sobolevn <mail@sobolevn.me> (cherry picked from commit 954b2cf)
…path (python#130071) Fixed an assertion error (so, it could be reproduced only in builds with assertions enabled) for `exec` when the `source` argument is a string and the `closure` argument is not `None`. Co-authored-by: sobolevn <mail@sobolevn.me> (cherry picked from commit 954b2cf)
|
GH-132627 is a backport of this pull request to the 3.13 branch. |
… path (GH-130071) (#132627) gh-130070: Fix `exec(<string>, closure=<non-None>)` unexpected path (#130071) Fixed an assertion error (so, it could be reproduced only in builds with assertions enabled) for `exec` when the `source` argument is a string and the `closure` argument is not `None`. Co-authored-by: sobolevn <mail@sobolevn.me> (cherry picked from commit 954b2cf)
Closes gh-130070