This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: File and lineno is not reported for syntax error in f-string
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: problem with traceback for syntax error in f-string
View: 34364
Assigned To: eric.smith Nosy List: eric.smith, ods, xtreak
Priority: normal Keywords:

Created on 2019-05-27 15:11 by ods, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg343639 - (view) Author: Denis S. Otkidach (ods) * Date: 2019-05-27 15:11
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.
msg343656 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2019-05-27 16:16
I'm pretty sure there's already an issue for this, but I don't have time to search for it now.

This is not an easy problem to solve. I've been working on it on and off for almost a year. I'll eventually get to it, but the changes are pretty invasive.
msg343657 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-05-27 16:24
Related open issue : issue34364. Also issue29051 which was closed as duplicate of issue34364.
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81246
2019-05-27 17:48:33SilentGhostsetstatus: open -> closed
superseder: problem with traceback for syntax error in f-string
resolution: duplicate
stage: resolved
2019-05-27 16:24:03xtreaksetnosy: + xtreak
messages: + msg343657
2019-05-27 16:16:47eric.smithsetassignee: eric.smith
messages: + msg343656
2019-05-27 15:16:22xtreaksetnosy: + eric.smith
2019-05-27 15:11:54odscreate