[issue13062] Introspection generator and function closure state

Eric Snow report at bugs.python.org
Thu Sep 29 22:54:04 CEST 2011


Eric Snow <ericsnowcurrently at gmail.com> added the comment:

See:
http://hg.python.org/cpython/file/default/Include/funcobject.h#l34
http://hg.python.org/cpython/file/default/Objects/funcobject.c#l454


   454 /* func_new() maintains the following invariants for closures.  The
   455    closure must correspond to the free variables of the code object.
   456 
   457    if len(code.co_freevars) == 0:
   458        closure = NULL
   459    else:
   460        len(closure) == len(code.co_freevars)
   461    for every elt in closure, type(elt) == cell
   462 */

----------

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


More information about the Python-bugs-list mailing list