You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve error message locations for future statements with unknown future features #126139
Currently, attempting to use a future statement with an unknown future feature produces a syntax error with the error location set to the start of the line:
$ python3 example.py
File "../example.py", line 1
from __future__ import does_not_exist
^
SyntaxError: future feature does_not_exist is not defined
This has some unfortunate UX in the new 3.13 REPL, where it results in only the f character at the start of the line being highlighted:
The UX is also suboptimal for future statements with multiple future features, since the error location doesn't show which feature is causing the error:
$ python3 example.py
File "../example.py", line 1
from __future__ import division, with_statement, pirnt_function
^
SyntaxError: future feature pirnt_function is not defined
It would be nice if the error location instead highlighted the specific future feature that isn't defined. Something like:
$ python3 example.py
File "../example.py", line 1
from __future__ import division, with_statement, pirnt_function
^^^^^^^^^^^^^^
SyntaxError: future feature pirnt_function is not defined
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Activity
Merge branch 'main' into pythongh-126139-future-err-loc
gh-126139: Improve error message location for future statement with u…
pythongh-126139: Improve error message location for future statement …
pythongh-126139: Improve error message location for future statement …
[3.12] pythongh-126139: Improve error message location for future sta…
[3.12] pythongh-126139: Improve error message location for future sta…
[3.13] gh-126139: Improve error message location for future statement…
[3.12] gh-126139: Improve error message location for future statement…
pythongh-126139: Improve error message location for future statement …
pythongh-126139: Improve error message location for future statement …