[issue14369] make __closure__ writable

2017-10-11 Thread Nick Coghlan
Nick Coghlan added the comment: Thinking about the interaction between this idea and https://bugs.python.org/issue30744 made me realise that there's a subtlety here that would probably need to be spelled out more clearly in the docs for __closure__ than it is for

[issue14369] make __closure__ writable

2017-10-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger ___ Python tracker ___ ___

[issue14369] make __closure__ writable

2017-10-10 Thread Nick Coghlan
Nick Coghlan added the comment: This still seems like a reasonable enhancement, but would presumably need updates to apply against the 3.7 development branch. -- versions: +Python 3.7 -Python 3.3 ___ Python tracker

[issue14369] make __closure__ writable

2017-10-10 Thread Devin Bayer
Devin Bayer added the comment: Any updates on this? I'm trying to implement hot module reloading using code from IPython, which tries to modify __closure__ in place. It fails silently and doesn't work, but indeed would be nice to have. --

[issue14369] make __closure__ writable

2017-10-10 Thread Devin Bayer
Change by Devin Bayer : -- nosy: +akvadrako ___ Python tracker ___ ___ Python-bugs-list

[issue14369] make __closure__ writable

2012-12-28 Thread Meador Inge
Changes by Meador Inge mead...@gmail.com: -- nosy: +meador.inge ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___ ___ Python-bugs-list

[issue14369] make __closure__ writable

2012-11-12 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___ ___ Python-bugs-list

[issue14369] make __closure__ writable

2012-04-28 Thread Andrew Svetlov
Andrew Svetlov andrew.svet...@gmail.com added the comment: sbt, looks good for me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___ ___

[issue14369] make __closure__ writable

2012-04-25 Thread Richard Oudkerk
Richard Oudkerk shibt...@gmail.com added the comment: Version of patch which checks invariants in the setter and adds tests. -- Added file: http://bugs.python.org/file25363/writable_closure_with_checking.patch ___ Python tracker

[issue14369] make __closure__ writable

2012-04-24 Thread Richard Oudkerk
Richard Oudkerk shibt...@gmail.com added the comment: Shouldn't test___closure__() also test what happens when the closure is replaced with None, or a tuple which is too long or too short or contains non-cell objects? All of these things seem to be checked when you create a new function using

[issue14369] make __closure__ writable

2012-04-24 Thread Richard Oudkerk
Richard Oudkerk shibt...@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()

[issue14369] make __closure__ writable

2012-04-24 Thread Yury Selivanov
Yury Selivanov yseliva...@gmail.com added the comment: The patch causes crashes. Yes, that's known. First, we need to check, that we can only write tuple of cell objects or None in __closure__ (that's easy to add). Secondly, perhaps, we can check __closure__ correctness each time we

[issue14369] make __closure__ writable

2012-04-23 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: Another use case for a writeable __closure__ attribute is to make it possible to manually break reference cycles: http://blog.ccpgames.com/kristjan/2012/04/23/reference-cycles-with-closures/ -- ___

[issue14369] make __closure__ writable

2012-03-20 Thread Andrew Svetlov
Andrew Svetlov andrew.svet...@gmail.com added the comment: Please update the doc also. I think changing from 'Read-only' to 'Writable' in Doc/reference/datamodel.rst is enough. -- ___ Python tracker rep...@bugs.python.org

[issue14369] make __closure__ writable

2012-03-20 Thread Yury Selivanov
Yury Selivanov yseliva...@gmail.com added the comment: Please update the doc also. I think changing from 'Read-only' to 'Writable' in Doc/reference/datamodel.rst is enough. Updated in writable_closure_03.patch. Thanks. -- Added file:

[issue14369] make __closure__ writable

2012-03-20 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___ ___

[issue14369] make __closure__ writable

2012-03-20 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___ ___

[issue14369] make __closure__ writable

2012-03-20 Thread Yury Selivanov
Yury Selivanov yseliva...@gmail.com added the comment: Updated patch per Benjamin's review. See writable_closure_04.patch. -- Added file: http://bugs.python.org/file24975/writable_closure_04.patch ___ Python tracker rep...@bugs.python.org

[issue14369] make __closure__ writable

2012-03-20 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___ ___ Python-bugs-list

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
New submission from Yury Selivanov yseliva...@gmail.com: __code__ and __closure__ are designed to work together. There is no point in allowing to completely substitute the __code__ object, but protecting the __closure__. -- components: Interpreter Core files: writable_closure.patch

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: Removed file: http://bugs.python.org/file24943/writable_closure.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: Added file: http://bugs.python.org/file24946/writable_closure.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
Yury Selivanov yseliva...@gmail.com added the comment: Updated patch as per Andrew's code review. Thank you. -- Added file: http://bugs.python.org/file24947/writable_closure_02.patch ___ Python tracker rep...@bugs.python.org