[New-bugs-announce] [issue43600] IDLE: fix highlight locationfor f-string field errors
Terry J. Reedy
report at bugs.python.org
Mon Mar 22 22:03:51 EDT 2021
New submission from Terry J. Reedy <tjreedy at udel.edu>:
Spinoff from #41064. In current python, the f'{*x}' traceback ends with
(*x)
^
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.
----------
assignee: terry.reedy
components: IDLE
messages: 389365
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE: fix highlight locationfor f-string field errors
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43600>
_______________________________________
More information about the New-bugs-announce
mailing list