[New-bugs-announce] [issue28582] Invalid backslash syntax errors are not always accurate as to the location on the line where the error occurs
Eric V. Smith
report at bugs.python.org
Tue Nov 1 14:23:42 EDT 2016
New submission from Eric V. Smith:
See msg279799 from issue28128, repeated here:
Seems the ^ pointer is not always correct. For example, in the function scope it's correct:
$ cat test.py
def foo():
s = 'C:\Program Files\Microsoft'
$ python3.7 -W error test.py
File "test.py", line 2
s = 'C:\Program Files\Microsoft'
^
SyntaxError: invalid escape sequence \P
On the other hand, top-level literals confuses the pointer:
$ cat test.py
s = 'C:\Program Files\Microsoft'
$ python3.7 -W error test.py
File "test.py", line 1
s = 'C:\Program Files\Microsoft'
^
SyntaxError: invalid escape sequence \P
Is that expected?
----------
components: Interpreter Core
messages: 279888
nosy: Chi Hsuan Yen, eric.smith
priority: normal
severity: normal
status: open
title: Invalid backslash syntax errors are not always accurate as to the location on the line where the error occurs
type: behavior
versions: Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28582>
_______________________________________
More information about the New-bugs-announce
mailing list