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
Error message for walrus etc. in PEP 695 contexts could be improved #104572
It would also be nice if the error display had a ^ pointing to the precise location. Unfortunately that appears to be difficult, as the error is raised in symtable.c where we no longer have access to the original source. The same thing happens with other syntax errors raised in symtable.c:
>>> def f(a, a): pass
...
File "<stdin>", line 1
SyntaxError: duplicate argument 'a' in function definition
The quotes might have come from thinking of 'named expression' as a grammar target, but then it would have to really be in the doc grammar and would need a hyphen. Error messages should save quotes for quotes from the code, as with 'a' above.
Activity
pythongh-104572: Improve error messages for invalid constructs in PEP…
JelleZijlstra commentedon May 17, 2023
It would also be nice if the error display had a ^ pointing to the precise location. Unfortunately that appears to be difficult, as the error is raised in symtable.c where we no longer have access to the original source. The same thing happens with other syntax errors raised in symtable.c:
terryjreedy commentedon May 17, 2023
The quotes might have come from thinking of 'named expression' as a grammar target, but then it would have to really be in the doc grammar and would need a hyphen. Error messages should save quotes for quotes from the code, as with 'a' above.
gh-104572: Improve error messages for invalid constructs in PEP 695 c…
Merge branch 'main' into 709funconly
pythongh-104572: Improve error messages for invalid constructs in PEP…