homepage

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.

classification
Title: IDLE cannot locate certain SyntaxErrors raised by f-string expressions
Type: Stage: resolved
Components: IDLE Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Improve error reporting involving f-strings (PEP 498)
View: 29051
Assigned To: terry.reedy Nosy List: bup, eric.smith, terry.reedy
Priority: normal Keywords:

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) * (Python committer) 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) * (Python committer) 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:56adminsetgithub: 76756
2018年01月17日 06:25:43terry.reedysetstatus: open -> closed
superseder: Improve error reporting involving f-strings (PEP 498)
messages: + msg310141

resolution: duplicate
stage: resolved
2018年01月16日 23:09:54eric.smithsetnosy: + eric.smith
messages: + msg310119
2018年01月16日 22:16:02bupcreate

AltStyle によって変換されたページ (->オリジナル) /