Issue 32575: IDLE cannot locate certain SyntaxErrors raised by f-string expressions
Issue32575
Created on 2018-01-16 22:16 by bup, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg310117 - (view) | Author: Dan Snider (bup) * | Date: 2018-01-16 22:16 | |
For example the following f-string
f'{1):.1%}'
IDLE will scroll to the top of the file and highlight a random and irrelevant line (not sure what it's doing tbh).
running the expression with `exec` makes it look like implicit parenthesis are added to the ends of files..
>>> exec("f'{1):.1f}'")
Traceback (most recent call last):
File "<pyshell#2860>", line 1, in <module>
exec("f'{1):.1f}'")
File "<fstring>", line 1
(1))
^
SyntaxError: unexpected EOF while parsing
IDLE can correctly find a `(1))` in a file but appears to fail only in f-string expressions.
|
|||
| msg310119 - (view) | Author: Eric V. Smith (eric.smith) * ![]() |
Date: 2018-01-16 23:09 | |
This is not an IDLE bug, per se. There's a known problem with f-strings not producing the correct line numbers. See issue #29051. Unless Terry thinks there's something IDLE-specific here, I suggest closing this as a duplicate. |
|||
| msg310141 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2018-01-17 06:25 | |
Syntax errors come from Python, not IDLE. Except for the pseudofile name ('<pyshell*nnnn>' versus '<stdin>'), the message is the same as the interactive interpreter. Anytime one thinks IDLE has a bug, one should check the standard interactive interpreter as a 'control'.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:56 | admin | set | github: 76756 |
| 2018-01-17 06:25:43 | terry.reedy | set | status: open -> closed superseder: Improve error reporting involving f-strings (PEP 498) messages: + msg310141 resolution: duplicate |
| 2018-01-16 23:09:54 | eric.smith | set | nosy:
+ eric.smith messages: + msg310119 |
| 2018-01-16 22:16:02 | bup | create | |
