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: Some Errors involving formatted strings aren't reported in the right place.
Type: behavior Stage: resolved
Components: Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: problem with traceback for syntax error in f-string
View: 34364
Assigned To: Nosy List: Enewman, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2018-11-29 20:00 by Enewman, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
recreation.py Enewman, 2018-11-29 20:00 a very short file that shows the effects of the problem
Messages (3)
msg330719 - (view) Author: Evan Newman (Enewman) Date: 2018-11-29 20:00
Formatted strings seem to have some quirks.  
if you try putting in this, for example;
print(f'{0 0}')
; you get a syntax error, which is probably intended, but where the error is reported is not always accurate.  for example;
#just a comment, it doesn't matter what it says
print(f'{0 0}')
;will raise the syntax error, and highlight the j,u,and s in the comment!  that doesn't help, and makes it look like the comment is the error.  this is a real pain to debug if you hadn't known about this.  it took me about 2 hours to track down the problem.  seriously, this should be fixed.  I haven't tested the problem in any editor but idle, so the cause could be anywhere.  I was first using 3.7.0, I've just updated to 3.7.1 to make sure it still happens, and it does.
msg330723 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-11-29 20:20
This looks like a duplicate of issue34364.
msg330726 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-11-29 21:49
Evan, IDLE runs your code with the Python running IDLE.  Bad tracebacks are created by Python and are usually, as in this case, the fault of Python.  To decide, run your code directly with Python, at a command line, instead of indirectly with IDLE, and see if you get the same problem.  

In this case, I ran, on Windows, in Command Prompt, 'py -m a.tem3', where 'py' defaults to python 3.7.1 and 'a' is a directory on sys.path.
History
Date User Action Args
2022-04-11 14:59:08adminsetgithub: 79536
2018-11-29 21:49:26terry.reedysetstatus: open -> closed
messages: + msg330726

assignee: terry.reedy ->
components: - IDLE
stage: resolved
2018-11-29 20:20:11serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg330723
resolution: duplicate

superseder: problem with traceback for syntax error in f-string
2018-11-29 20:17:53Enewmansettitle: Some Errors involving formatted strings aren't reported in the right place. -> Some Errors involving formatted strings aren't reported in the right place.
2018-11-29 20:00:38Enewmancreate