[issue42837] Symbol table incorrectly identifies code as a generator, when 'yield' occurs in an annotation

Mark Shannon report at bugs.python.org
Wed Jan 6 06:00:10 EST 2021


Mark Shannon <mark at hotpy.org> added the comment:

The aim is to change the behavior of the symbol table to match the compiler.
The behavior has already changed at module scope.

Python 3.9.0+
>>> x:(yield None)
  File "<stdin>", line 1
SyntaxError: 'yield' outside function
>>> 


Python 3.10.0a4+
>>> x:(yield None)
>>>

----------

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


More information about the Python-bugs-list mailing list