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 <rep...@bugs.python.org>
<http://bugs.python.org/issue28582>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to