>>> import typing as t; None = 1
File "<python-input-0>", line 1
import typing as t; None = 1
^
SyntaxError: cannot use name as import target
>>> import typing as t; None = 1
File "<python-input-0>", line 1
import typing as t; None = 1
^^^^
SyntaxError: cannot assign to None
We should restore the old message for this case.
I have a patch ready.
Bug report
Bug description:
Currently we have:
which doesn't make sense. Prior to #123629, it was:
We should restore the old message for this case.
I have a patch ready.
CPython versions tested on:
CPython main branch, 3.14
Operating systems tested on:
Linux
Linked PRs
SyntaxErrormessage for invalid syntax following valid import-as statement #138945SyntaxErrormessage for invalid syntax following valid import-as statement (GH-138945) #140646