New submission from Lysandros Nikolaou <[email protected]>:
While investigating bpo-40958, the following came up:
When a file ends with a line that contains a line continuation character the
text of the emitted SyntaxError is empty, contrary to the old parser, where the
error text contained the text of the last line. Here is an example:
cpython git:(master)$ cat t.py
x = 6\%
cpython git:(master)$ ./python t.py
File "/home/lysnikolaou/repos/cpython/t.py", line 2
^
SyntaxError: unexpected EOF while parsing
cpython git:(master)$ python3.9 -X oldparser t.py
File "/home/lysnikolaou/repos/cpython/t.py", line 2
x = 6\
^
SyntaxError: unexpected EOF while parsing
----------
components: Interpreter Core
messages: 371544
nosy: lys.nikolaou
priority: normal
severity: normal
status: open
title: PEG Parser: SyntaxError text empty when last line has a LINECONT
type: behavior
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40985>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com