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 lys.nikolaou
Recipients gvanrossum, lys.nikolaou, pablogsal
Date 2020-05-07.16:05:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588867521.75.0.200197181166.issue40546@roundup.psfhosted.org>
In-reply-to
Content
Since traceback is programmed to match the SyntaxErrors emitted by the old parser, there are some inconsistencies between how it formats SyntaxErrors and how the new parser does it. One example for such behaviour is the following:

New Parser:
╰─ ./python.exe
Python 3.9.0a6+ (heads/master:4638c64295, May  7 2020, 16:47:53)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 1 | 2 |
  File "<stdin>", line 1
    x = 1 | 2 |
               ^
SyntaxError: invalid syntax

Old parser and traceback module:
╰─ ./python.exe -X oldparser
Python 3.9.0a6+ (heads/master:4638c64295, May  7 2020, 16:47:53)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 1 | 2 |
  File "<stdin>", line 1
    x = 1 | 2 |
              ^
SyntaxError: invalid syntax

We actually think that the new parser does a better job here, since there is nothing wrong with the `|` itself, the error is that a newline follows it and that's where the caret should point to.

Tests that are testing this are currently skipped. I think we should change traceback to match the new parser, wherever we think the new parser does a better job, and "unskip" these tests.
History
Date User Action Args
2020-05-07 16:05:21lys.nikolaousetrecipients: + lys.nikolaou, gvanrossum, pablogsal
2020-05-07 16:05:21lys.nikolaousetmessageid: <1588867521.75.0.200197181166.issue40546@roundup.psfhosted.org>
2020-05-07 16:05:21lys.nikolaoulinkissue40546 messages
2020-05-07 16:05:21lys.nikolaoucreate