[issue40246] Different error messages for same error - invalid string prefixes
Pablo Galindo Salgado
report at bugs.python.org
Wed Apr 29 15:28:54 EDT 2020
Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:
> If it's all handled by the tokenizer, how come it's different in the newparser?
Is not different in the new parser: both parsers have analogous behaviour now:
~/github/python/master master
❯ ./python
Python 3.9.0a6+ (heads/master:84724dd239, Apr 29 2020, 20:26:52)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
File "<stdin>", line 1
norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
^
SyntaxError: invalid string prefix
>>>
~/github/python/master master
❯ ./python -X oldparser
Python 3.9.0a6+ (heads/master:84724dd239, Apr 29 2020, 20:26:52)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
File "<stdin>", line 1
norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
^
SyntaxError: invalid string prefix
This issue is exclusively due to the changes in https://github.com/python/cpython/pull/19476 if I understand correctly.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40246>
_______________________________________
More information about the Python-bugs-list
mailing list