-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-130775: Allow negative locations in ast
#130795
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
Conversation
sobolevn
commented
Mar 3, 2025
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Crash in Python/assemble.c:301: write_location_info_entry: Assertion `column >= -1' failed. #130775
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we cannot bypass the ast.c layer and directly end up in the assemble.c, then this should be the correct approach (I didn't know where we validate the locations).
{'lineno': -2, 'col_offset': 0}, | ||
{'lineno': 0, 'col_offset': -2}, | ||
{'lineno': 0, 'col_offset': -2, 'end_col_offset': -2}, | ||
{'lineno': -2, 'end_lineno': -2, 'col_offset': 0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Off topic: are we already testing that passing a non-int is fine?
- Maybe test with values that are excessively large (either in + or -) just for overflow checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will open a new issue for that, if we don't. Thanks for the idea.
Co-authored-by: Victor Stinner <vstinner@python.org>
Misc/NEWS.d/next/Core_and_Builtins/2025-03-03-20-02-45.gh-issue-130775.fEM6T-.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I just suggest a shorter test name :-)
Misc/NEWS.d/next/Core_and_Builtins/2025-03-03-20-02-45.gh-issue-130775.fEM6T-.rst
Outdated
Show resolved
Hide resolved
I remove my LGTM vote, I didn't notice that -1 value is still allowed. I'm not sure about rejecting values <= -2
.
Ok, I followed the idea in #130795 (comment) by @JelleZijlstra and now all negative locations are just allowed. This way we won't have any compat issues and can backport this fix easily. Thanks a lot, everyone! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Looks like #130627 changed a lot of related things. Digging into it. |
Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @sobolevn, I could not cleanly backport this to
|
Sorry, @sobolevn, I could not cleanly backport this to
|
Thanks everyone! 🎉 |
I will work on manual backports today. |
ast
ast
GH-132243 is a backport of this pull request to the 3.13 branch. |
GH-132260 is a backport of this pull request to the 3.12 branch. |
Co-authored-by: Victor Stinner <vstinner@python.org>