bpo-46042: Improve SyntaxError locations in the symbol table#30059
bpo-46042: Improve SyntaxError locations in the symbol table#30059pablogsal merged 3 commits intopython:mainfrom
Conversation
|
Looks good to me! I like the macros and just having |
|
I think we could be even more general. It seems the other two remaining uses of [x for x in range(10)
if (yield) == 5]def f():
from math import * |
|
The second one is a bit more complex because we would need to identify which of the comprehension generators have a 'yield' inside, but that happens downstream from us in the visitors. |
|
From the second example I have submitted another commit |
|
PyPy has the equivalent of an extra |
We would need to also know the comprehension type to raise properly, which is a bit messy. Do you have one extra enum or 4 extra ones? Edit: I did a prototype but is quite long so I will do this in another PR |
|
Nevermind, I found a better workaround that is not too inelegant IMHO |
|
Nice, that's a good approach! |
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
|
GH-30064 is a backport of this pull request to the 3.10 branch. |
|
https://bugs.python.org/issue46042