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
Symbol table incorrectly identifies code as a generator, when 'yield' occurs in an annotation #87003
Comments
This is an internal inconsistency. I have not identified any surface level bugs, but it is a trap for future compiler work. |
This is a duplicate of bpo-42725. |
No this is not a duplicate. |
Does not it change the current behavior? I do not see a difference with bpo-42725. >>> def f():
... x: (yield)
...
>>> f()
<generator object f at 0x7f971b45d950> |
The aim is to change the behavior of the symbol table to match the compiler. Python 3.9.0+
>>> x:(yield None)
File "<stdin>", line 1
SyntaxError: 'yield' outside function
>>>
Python 3.10.0a4+
>>> x:(yield None)
>>> |
Then why not fix the compiler? As I understand, it is not clear yet what behavior should be, and discussing it is the matter of bpo-42725. Any changes before the decision be made are preliminary. It is very likely that the decision will be in favor of ignoring annotations. In that case your PR or even more radical changes can be merged. |
OK, I won't merge anything yet. |
Well even though I still don't understand 'how this issue is different than bpo-42725', I don't think you actually fix the symbol table; Annotations still have side effects on the symbol table (even though they shouldn't have). and I already had a fix but decided not to go for it until bpo-42737 is resolved since it would make the language inconsistent. Just FYI. |
I guess this will be resolved when the great PEP 563/649 debate is concluded. No need for another issue. |
AFAIK this is already resolved on the main (https://bugs.python.org/issue42725) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: