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
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject() always set the offset attribute to None #72698
Comments
The purpose of PyErr_SyntaxLocationEx() function (added in 00e4ce31d404) was setting the offset attribute of raised syntax error to specified value. But this never worked as expected. The offset attribute is set to integer value in Python/errors.c:1067, but then replaced with None in Python/errors.c:1083. |
Here is a patch that makes PyErr_SyntaxLocationObject() setting correct offset. |
Looks good apart from one quirky test case, see Reitveld |
Good catch Martin! Opened bpo-28936 for that quirky test. |
New changeset ea1c49ea8136 by Serhiy Storchaka in branch '3.5': New changeset df59faf7fa59 by Serhiy Storchaka in branch '3.6': New changeset 72aaef2d144b by Serhiy Storchaka in branch 'default': |
Hi Serhiy, there are two commented-out lines in https://hg.python.org/cpython/rev/ea1c49ea8136#l3.10 (only in 3.5) + #with self.assertRaises(AssertionError): |
Ah, it was a remnants of backporting to 3.5. Commented-out lines are used in 3.6. The line above these lines was used in 3.5. Test is passed with both variants. I commented out the 3.6 variant, but forgot to remove it (or remove old 3.5 variant and keep 3.6 variant). Do you think I should remove commented out lines, or left the code as is? |
Misc/NEWS
so that it is managed by towncrier #552Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: