[New-bugs-announce] [issue37065] File and lineno is not reported for syntax error in f-string

Denis S. Otkidach report at bugs.python.org
Mon May 27 11:11:54 EDT 2019


New submission from Denis S. Otkidach <denis.otkidach at gmail.com>:

Minimal example to reproduce:

-->8--
>>> with open('f_bug.py', 'w') as fp:
...     fp.write('f"{a b}"')
... 
8
>>> import f_bug
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<fstring>", line 1
    (a b)
       ^
SyntaxError: invalid syntax
-->8--

Here we see in track trace "<fstring>" and line number in erroneous expression in f-string, but no "f_bug.py" and line number in it.

----------
components: Interpreter Core
messages: 343639
nosy: ods
priority: normal
severity: normal
status: open
title: File and lineno is not reported for syntax error in f-string
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37065>
_______________________________________


More information about the New-bugs-announce mailing list