[pypy-issue] Issue #2464: getset_descriptor cannot access `__objclass__` (pypy/pypy)

Mike McKerns issues-reply at bitbucket.org
Wed Jan 11 08:41:17 EST 2017


New issue 2464: getset_descriptor cannot access `__objclass__`
https://bitbucket.org/pypy/pypy/issues/2464/getset_descriptor-cannot-access

Mike McKerns:

It looks like a getset_descriptor has an `__objclass__` (as seen with `dir`), but it's not available as an attribute.  `__objclass__` is very useful in maintaining a pointer to the descriptor's class.  For example, given an `__objclass__` attribute, one could pickle a descriptor... and thus make a broader class of objects available to multiprocessing, parallel, and distributed computing.  (I'm the `dill` author, and this is a huge blocker for people using `pypy` + `dill`)

```
#!python

>>>> class _d(object):
....   def _method(self):
....     pass
....     
>>>> d = _d.__dict__['__dict__']
>>>> d
<getset_descriptor object at 0x0000000104d4b3f0>
>>>> dir(d)
['__class__', '__delattr__', '__delete__', '__doc__', '__format__', '__get__', '__getattribute__', '__hash__', '__init__', '__name__', '__new__', '__objclass__', '__reduce__', '__reduce_ex__', '__repr__', '__set__', '__setattr__', '__str__', '__subclasshook__']
>>>> d.__objclass__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: generic property has no __objclass__
```

Can the `__objclass__` attribute be made available as a pointer to the descriptor's class?  It seems like a bug that `__objclass__` is missing.




More information about the pypy-issue mailing list