homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject() always set the offset attribute to None
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, berker.peksag, martin.panter, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016年10月22日 21:50 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
PyErr_SyntaxLocationObject-offset.patch serhiy.storchaka, 2016年11月20日 22:04 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017年03月31日 16:36
Messages (7)
msg279224 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016年10月22日 21:50
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.
msg281305 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016年11月20日 22:04
Here is a patch that makes PyErr_SyntaxLocationObject() setting correct offset.
msg282913 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016年12月11日 09:36
Looks good apart from one quirky test case, see Reitveld
msg282917 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016年12月11日 12:34
Good catch Martin! Opened issue28936 for that quirky test.
msg282918 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016年12月11日 12:44
New changeset ea1c49ea8136 by Serhiy Storchaka in branch '3.5':
Issue #28512: Fixed setting the offset attribute of SyntaxError by
https://hg.python.org/cpython/rev/ea1c49ea8136
New changeset df59faf7fa59 by Serhiy Storchaka in branch '3.6':
Issue #28512: Fixed setting the offset attribute of SyntaxError by
https://hg.python.org/cpython/rev/df59faf7fa59
New changeset 72aaef2d144b by Serhiy Storchaka in branch 'default':
Issue #28512: Fixed setting the offset attribute of SyntaxError by
https://hg.python.org/cpython/rev/72aaef2d144b 
msg283055 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016年12月12日 21:57
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):
+ #support.check_syntax_error(self, "x=1")
msg283080 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016年12月13日 07:35
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?
History
Date User Action Args
2022年04月11日 14:58:38adminsetgithub: 72698
2017年03月31日 16:36:35dstufftsetpull_requests: + pull_request1082
2016年12月21日 10:12:21serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016年12月13日 07:35:55serhiy.storchakasetmessages: + msg283080
2016年12月12日 21:57:43berker.peksagsetnosy: + berker.peksag
messages: + msg283055
2016年12月11日 12:44:52python-devsetnosy: + python-dev
messages: + msg282918
2016年12月11日 12:34:16serhiy.storchakasetmessages: + msg282917
2016年12月11日 09:36:10martin.pantersetmessages: + msg282913
2016年12月11日 08:00:34serhiy.storchakasetnosy: + martin.panter
2016年11月20日 22:04:29serhiy.storchakasetfiles: + PyErr_SyntaxLocationObject-offset.patch
keywords: + patch
messages: + msg281305

stage: patch review
2016年10月22日 21:50:07serhiy.storchakacreate

AltStyle によって変換されたページ (->オリジナル) /