[issue42725] PEP 563: Should the behavior change for yield/yield from's

Batuhan Taskaya report at bugs.python.org
Fri Apr 23 18:08:40 EDT 2021


Batuhan Taskaya <isidentical at gmail.com> added the comment:

> This was easy in my 649 branch; walrus adds locals, and yield / yield from make it a generator.  So the code raises an error if the generated annotations code object has locals or is a generator.  I don't think I had to do anything special to prohibit await, because that's only valid in a function declared "async def", which annotations code objects are not.

The implementation I have right now just adds a new state to the symbol table, and raises error in the visitors (like switch Yield, YieldFrom etc).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42725>
_______________________________________


More information about the Python-bugs-list mailing list