[Python-Dev] Security capabilities in Python
mwh at python.net
Sun Apr 10 17:34:17 CEST 2005
James Y Knight <foom at fuhm.net> writes:
> On Apr 9, 2005, at 2:13 PM, Michael Hudson wrote:
>> The funniest I know is part of PyPy:
>> def extract_cell_content(c):
>> """Get the value contained in a CPython 'cell', as read through
>> the func_closure of a function object."""
>> # yuk! this is all I could come up with that works in Python 2.2
>> class X(object):
>> def __eq__(self, other):
>> self.other = other
>> x = X()
>> x_cell, = (lambda: x).func_closure
>> x_cell == c
>> return x.other
>> It would be unfortunate for PyPy (and IMHO, very un-pythonic) if this
>> process became impossible.
> It would be quite fortunate if you didn't have to do all that, and
> cell just had a "value" attribute, though.
Indeed. The 2.2 compatibility issue remains, though.
Presumably pronging in the wrong place zogs it.
-- Aldabra Stoddart, ucam.chat
More information about the Python-Dev