[issue14369] make __closure__ writable
Richard Oudkerk
report at bugs.python.org
Wed Apr 25 01:37:57 CEST 2012
Richard Oudkerk <shibturn at gmail.com> added the comment:
The patch causes crashes. If I define
def cell(o):
def f(): o
return f.__closure__[0]
def f():
a = 1
b = 2
def g():
return a + b
return g
g = f()
then I find
g.__closure__ = None; g() -> crash
g.__closure__ = (cell(3),); g() -> crash
g.__closure__ = (1, 2); g() -> SystemError *
g.__closure__ = (cell(3), cell(4), cell(5)); g() -> returns 7
* SystemError: ..\Objects\cellobject.c:24: bad argument to internal function
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14369>
_______________________________________
More information about the Python-bugs-list
mailing list