Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong line number for f-string syntax errors #7914

Closed
sam-s opened this issue Dec 9, 2022 · 1 comment
Closed

wrong line number for f-string syntax errors #7914

sam-s opened this issue Dec 9, 2022 · 1 comment

Comments

@sam-s
Copy link

sam-s commented Dec 9, 2022

Bug description

When there is a syntax error in the code called from an f-string, pylint issues an uninformative message with a wrong line number.
This happens with pylint 2.15.8 but not with 2.15.6.
However, the problem is probably with the older Python.

"https://github.com/PyCQA/pylint/issues/7914"
# the error is in the next line
print(f"{f(x}}")

Command used

pylint a.py

Pylint output

************* Module a
a.py:1: [E0001(syntax-error), ] Parsing failed: 'invalid syntax (<fstring>, line 1)'

Expected behavior

************* Module a
a.py:3: [E0001(syntax-error), ] Parsing failed: 'f-string: closing parenthesis '}' does not match opening parenthesis '(' (<unknown>, line 3)'

Pylint version

  • good output:
pylint 2.15.6
astroid 2.12.13
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
  • bad output:
pylint 2.15.8
astroid 2.12.13
Python 3.7.15 (default, Oct 31 2022, 22:44:31) 
[GCC 7.3.1 20180712 (Red Hat 7.3.1-15)]

OS / Environment

both linux

@sam-s sam-s added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 9, 2022
@Pierre-Sassoulas
Copy link
Member

This is something we do not control, the ast module got better in cpython for python 3.8 and above. Closing as there's nothing we can reasonably do.

@Pierre-Sassoulas Pierre-Sassoulas closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Won't fix/not planned and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants