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.

Author gvanrossum
Recipients gvanrossum, lys.nikolaou, pablogsal
Date 2020-05-13.04:18:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589343535.08.0.511471445795.issue40612@roundup.psfhosted.org>
In-reply-to
Content
The traceback module formats several edge cases of SyntaxError different than CPython's default formatting.

- There's an off-by-one error if the column offset (printed as a caret) points past the last character (example: 'a +='). The clipping is wrong and the caret points to the last character.

- If the offset is <= 0, it appears the code silently adds the length of the source text.

- The system formatting suppresses the caret if the offset is -1; the only way to suppress the caret with the traceback module is setting the offset to None (or setting the source text to None).

- The system formatting can position the caret way past the end of the source text; the traceback module clips (also see the first bullet).

I propose to make the traceback module behave the same way as the system module in all cases. I also propose to make both suppress the caret if the offset is <= 0. Finally I propose to make the system formatting limit the offset to just past the end of the source text.

I propose not to bother changing anything in 3.8 or before.
History
Date User Action Args
2020-05-13 04:18:55gvanrossumsetrecipients: + gvanrossum, lys.nikolaou, pablogsal
2020-05-13 04:18:55gvanrossumsetmessageid: <1589343535.08.0.511471445795.issue40612@roundup.psfhosted.org>
2020-05-13 04:18:55gvanrossumlinkissue40612 messages
2020-05-13 04:18:54gvanrossumcreate