[Bug 1872209] [NEW] syntax error message in f-string doesn't report line number
Simon Lambourn
simon.lambourn at gmail.com
Sat Apr 11 16:16:38 UTC 2020
Public bug reported:
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):
print(f"main() called with *args={*args}, **kwargs={**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
ProcVersionSignature: Ubuntu 5.3.0-46.38-generic 5.3.18
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)
** Affects: python3-defaults (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug eoan
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1872209
Title:
syntax error message in f-string doesn't report line number
Status in python3-defaults package in Ubuntu:
New
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):
print(f"main() called with *args={*args}, **kwargs={**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
ProcVersionSignature: Ubuntu 5.3.0-46.38-generic 5.3.18
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)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1872209/+subscriptions
More information about the foundations-bugs
mailing list