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: IDLE: fix highlight locationfor f-string field errors
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.10, Python 3.9, Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: terry.reedy
Priority: normal Keywords:

Created on 2021-03-23 02:03 by terry.reedy, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg389365 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-03-23 02:03
Spinoff from #41064.  In current python, the f'{*x}' traceback ends with 

SyntaxError: f-string: can't use starred expression here.

For f'{**x}', the message is "f-string: invalid syntax" and the ^ is also under the 2nd character in the replacement expression actually parsed (with a restricted grammar).

The Python error handler must special case a syntax error message beginning with 'f-string:' and search the input line for {...} and add its offset.

IDLE currently highlights "'", the 2nd char of the original code, instead of '*', the 2nd char of the e.text replacement.  It needs to also adjust the offset.
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87766
2021-03-23 02:03:51terry.reedycreate