[issue13062] Introspection generator and function closure state

Nick Coghlan report at bugs.python.org
Mon Oct 3 04:02:59 CEST 2011


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Because a generator can legitimately have no locals:

>>> def gen():
...     yield 1
... 
>>> g = gen()
>>> g.gi_frame.f_locals
{}

Errors should be reported as exceptions - AttributeError or TypeError if there's no gi_frame and then ValueError or RuntimeError if gi_frame is None.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13062>
_______________________________________


More information about the Python-bugs-list mailing list