syntax error message in f-string doesn't report line number
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python3-defaults (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I accidentally came across this annoying 'feature' or more likely, bug.
The following code
f"...foo ... {**kwargs} ..."
produces a very basic syntax error message with no line number in the source file:
File "<fstring>", line 1
(**kwargs)
^
SyntaxError: invalid syntax
This is the error message I would expect from the interpreter, but not when running a python script. A demo script is as follows:
''' f-string bug demonstration '''
def main(*args, **kwargs):
With a longer python file, it is hard to find the offending line. Should the line number be displayed in the error message?
ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: python3 3.7.5-1
ProcVersionSign
Uname: Linux 5.3.0-46-generic x86_64
ApportVersion: 2.20.11-0ubuntu8.8
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat Apr 11 17:08:35 2020
SourcePackage: python3-defaults
UpgradeStatus: Upgraded to eoan on 2019-10-23 (170 days ago)