[New-bugs-announce] [issue43555] Location of SyntaxError with new parser missing (after continuation character)

Andre Roberge report at bugs.python.org
Fri Mar 19 07:18:52 EDT 2021


New submission from Andre Roberge <andre.roberge at gmail.com>:

Normally, for SyntaxErrors, the location of the error is indicated by a ^. There is at least one case where the location is missing for 3.9 and 3.10.0a6 where it was shown before. Using the old parser for 3.9, or with previous versions of Python, the location is shown.

Python 3.10.0a6 ... on win32
>>> a = 3 \ 4
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>>


Python 3.9.0 ... on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 3 \ 4
  File "<stdin>", line 1
SyntaxError: unexpected character after line continuation character
>>>

Using the old parser with Python 3.9, the location of the error is shown *after* the unexpected character.

> python -X oldparser
Python 3.9.0 ... on win32
>>> a = 3 \ 4
  File "<stdin>", line 1
    a = 3 \ 4
             ^
SyntaxError: unexpected character after line continuation character
>>>

Using Python 3.8 (and 3.7, 3.6), the location is pointing at the unexpected character.


Python 3.8.4 ... on win32
>>> a = 3 \ 4
  File "<stdin>", line 1
    a = 3 \ 4
            ^
SyntaxError: unexpected character after line continuation character
>>>

----------
components: Interpreter Core
messages: 389071
nosy: aroberge
priority: normal
severity: normal
status: open
title: Location of SyntaxError with new parser missing (after continuation character)
type: behavior
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43555>
_______________________________________


More information about the New-bugs-announce mailing list