-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
gh-92597: Improve error message for AST nodes with invalid ranges #93398
Conversation
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 (a quick comment below)
Python/ast.c
Outdated
node->lineno, node->end_lineno); \ | ||
return 0; \ | ||
} \ | ||
if ((node->lineno < 0 && node->end_lineno != node->lineno) || \ | ||
(node->col_offset < 0 && node->col_offset != node->end_col_offset)) { \ | ||
PyErr_Format(PyExc_ValueError, \ | ||
"line %d-%d, column %d-%d is not a valid range", \ | ||
node->lineno, node->end_lineno, node->col_offset, node->end_col_offset); \ | ||
"AST node column range (%d, %d) for line %d is not valid", \ |
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.
Do we want to include the end_lineno
here as well (since it is part of the original condition):
if ((node->lineno < 0 && node->end_lineno != node->lineno) || \
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
GH-93414 is a backport of this pull request to the 3.11 branch. |
…es (pythonGH-93398) (cherry picked from commit 8a221a8) Co-authored-by: Pablo Galindo Salgado <[email protected]>
…-93398) (GH-93414) (cherry picked from commit 8a221a8) Co-authored-by: Pablo Galindo Salgado <[email protected]>
No description provided.