New submission from Terry J. Reedy <[email protected]>:
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 <[email protected]>
<https://bugs.python.org/issue43600>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com