[issue37433] syntax error in multiline f-string produces ~40k spaces output
Aaron Meurer
report at bugs.python.org
Fri Aug 2 23:07:43 EDT 2019
Aaron Meurer <asmeurer at gmail.com> added the comment:
This seems related. It's also possible I'm misunderstanding what is supposed to happen here.
If you create test.py with just the 2 lines:
"""
a
and run python test.py from CPython master, you get
$./python.exe test.py
File "/Users/aaronmeurer/Documents/cpython/test.py", line 4
a
^
SyntaxError: EOF while scanning triple-quoted string literal
Notice that it reports line 4 even though the file only has 2 lines.
The offset in the syntax error is 6 columns (line numbers and column offsets
in SyntaxErrors count from 1)
>>> try:
... compile('"""\na', '<none>', 'exec')
... except SyntaxError as e:
... print(repr(e))
...
SyntaxError('EOF while scanning triple-quoted string literal', ('<none>', 2, 6, '"""\na\n'))
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37433>
_______________________________________
More information about the Python-bugs-list
mailing list