[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 __code__: any changes made to

[issue14369] make __closure__ writable

2017-10-10 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[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. -- ___ Pytho

[issue14369] make __closure__ writable

2017-10-10 Thread Devin Bayer
Change by Devin Bayer : -- nosy: +akvadrako ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue14369] make __closure__ writable

2012-12-28 Thread Meador Inge
Changes by Meador Inge : -- nosy: +meador.inge ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue14369] make __closure__ writable

2012-11-12 Thread Eric Snow
Changes by Eric Snow : -- nosy: +eric.snow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue14369] make __closure__ writable

2012-04-28 Thread Andrew Svetlov
Andrew Svetlov added the comment: sbt, looks good for me. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue14369] make __closure__ writable

2012-04-25 Thread Richard Oudkerk
Richard Oudkerk 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 Yury Selivanov
Yury Selivanov 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 start evaluating a code

[issue14369] make __closure__ writable

2012-04-24 Thread Richard Oudkerk
Richard Oudkerk 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

[issue14369] make __closure__ writable

2012-04-24 Thread Richard Oudkerk
Richard Oudkerk 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 types.FunctionTyp

[issue14369] make __closure__ writable

2012-04-23 Thread Nick Coghlan
Nick Coghlan 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/ -- ___ Python tracker

[issue14369] make __closure__ writable

2012-03-20 Thread Yury Selivanov
Changes by Yury Selivanov : -- nosy: +ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue14369] make __closure__ writable

2012-03-20 Thread Yury Selivanov
Yury Selivanov 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 __

[issue14369] make __closure__ writable

2012-03-20 Thread Andrew Svetlov
Changes by Andrew Svetlov : -- nosy: +benjamin.peterson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue14369] make __closure__ writable

2012-03-20 Thread Andrew Svetlov
Changes by Andrew Svetlov : -- stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://m

[issue14369] make __closure__ writable

2012-03-20 Thread Yury Selivanov
Yury Selivanov 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: http://bugs.python.org/file24962/writable_closure_03.patch ___

[issue14369] make __closure__ writable

2012-03-20 Thread Andrew Svetlov
Andrew Svetlov 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 __

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
Yury Selivanov 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 ___

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
Changes by Yury Selivanov : Added file: http://bugs.python.org/file24946/writable_closure.patch ___ Python tracker ___ ___ Python-bugs-list ma

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
Changes by Yury Selivanov : Removed file: http://bugs.python.org/file24943/writable_closure.patch ___ Python tracker ___ ___ Python-bugs-list

[issue14369] make __closure__ writable

2012-03-19 Thread Yury Selivanov
New submission from Yury Selivanov : __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 keywords: patch messag