[pypy-issue] Issue #2865: types.MemberDescriptorType has wrong type (pypy/pypy)
Avram Lubkin
issues-reply at bitbucket.org
Mon Aug 6 22:11:52 EDT 2018
New issue 2865: types.MemberDescriptorType has wrong type
https://bitbucket.org/pypy/pypy/issues/2865/typesmemberdescriptortype-has-wrong-type
Avram Lubkin:
Affects 2.7 and 3.x
```
#!python
>>>> import types
>>>>
>>>> class C:
.... __slots__ = ('ivar',)
....
>>>> type(C.__dict__['ivar'])
<class 'member_descriptor'>
>>>>
>>>> types.MemberDescriptorType
<class 'getset_descriptor'>
```
This is due to the implementation. In CPython types is defined like this, which seems to be the same code in pypy.
```
#!python
def _f(): pass
FunctionType = type(_f)
MemberDescriptorType = type(FunctionType.__globals__)
```
It would be better to check a slot member's type instead. Not sure where is the right place to fix it, but I wanted to report it before I implemented a workaround.
More information about the pypy-issue
mailing list