[pypy-dev] Change function closure cell contents

Tin Tvrtković tinchester at gmail.com
Thu Jul 27 10:17:41 EDT 2017


Hello!

Here's a very simple example (Python 3):

>>>> class C:
....     def t(self):
....         return __class__
....
>>>> C.t.__closure__[0]
<cell at 0x0000000109eca0c0: type object at 0x00007f7f82c225b0>

My question is, what's the easiest/most natural way of changing the
contents of this closure cell on PyPy? On CPython there's a way using
ctypes.

This is regarding
https://github.com/python-attrs/attrs/issues/102, but the issue boils down
to this.

Cheers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20170727/cae6688a/attachment.html>


More information about the pypy-dev mailing list