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.

Title: problem with traceback for syntax error in f-string
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: bgailer, eric.smith, josh.r, ods, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-08-08 20:42 by bgailer, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10021 merged Anthony Sottile, 2018-10-28 09:55
Messages (6)
msg323301 - (view) Author: bob gailer (bgailer) Date: 2018-08-08 20:42
Inconsistent tracebacks. Note that the traceback for does not 
reference the
module file and line number.

def f():
   {d e}'''

import bug

Traceback (most recent call last):
   File "<fstring>", line 1
     (d e)
SyntaxError: invalid syntax


def f():

import bug2

Traceback (most recent call last):
   File "C:\python\", line 5, in <module>
NameError: name 'b' is not defined
msg323309 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2018-08-09 01:25
So the bug is that the line number and module are incorrect for the f-string, right? Nothing else?
msg323311 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-08-09 02:39
I think this is a duplicate, but I can't find the exact issue. I don't think it's exactly the same as #29051.
msg326264 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-09-24 16:35
I worked on this at the core sprint, and I have a patch almost ready.
msg326268 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-24 16:48
Great! I was going to take it. Will be glad to make a review.
msg326269 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-09-24 16:53
It's more elaborate than I'd like, but I think it's the right way to solve it: I'm passing in the starting line and column number to the parser machinery.
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78545
2020-11-19 12:39:34iritkatrielsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-02-05 22:05:07eric.smithlinkissue39564 superseder
2019-05-28 12:55:54odssetnosy: + ods
2019-05-27 17:48:33SilentGhostlinkissue37065 superseder
2018-11-29 20:20:11serhiy.storchakalinkissue35355 superseder
2018-10-28 09:55:54Anthony Sottilesetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request9494
2018-09-24 16:53:45eric.smithsetmessages: + msg326269
2018-09-24 16:48:48serhiy.storchakasetmessages: + msg326268
2018-09-24 16:35:09eric.smithsetmessages: + msg326264
2018-09-24 16:33:21serhiy.storchakasetnosy: + serhiy.storchaka
2018-08-09 02:39:06eric.smithsetassignee: eric.smith
type: behavior
components: + Interpreter Core
versions: + Python 3.6, Python 3.7, Python 3.8
nosy: + eric.smith

messages: + msg323311
stage: needs patch
2018-08-09 01:25:28josh.rsetnosy: + josh.r
messages: + msg323309
2018-08-08 20:42:15bgailercreate