[issue41064] Specialise syntax error of **dict in f-string field

Terry J. Reedy report at bugs.python.org
Mon Mar 22 22:11:13 EDT 2021


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Cressey noted both a compile and IDLE Shell issue.  They must be handled separately by different people in separate bpo issues.

The first is about the helpful versus less helpful SyntaxError messages in the following (master compiled today).

>>> f'{*x}'
  File "<stdin>", line 1
    (*x)
     ^
SyntaxError: f-string: can't use starred expression here
>>> f'{**x}'
  File "<stdin>", line 1
    (**x)
     ^
SyntaxError: f-string: invalid syntax

The request is make the 2nd message the same or like the 1st.  Seems like it should be possible.  I am limiting this bpo issue to this request and opened #43600 for fixing IDLE's highlight location.

Pablo, I leave it to you to handle the message enhancement request.  Do you know if there is any other situation like this in which the compiled text is not the input code?

----------
assignee: terry.reedy -> 
components:  -IDLE
title: f-string SyntaxError gives offset within fake line, other issues -> Specialise syntax error of **dict in f-string field

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


More information about the Python-bugs-list mailing list