New issue 1982: ctypes.Structure subclasses munge `_names` attribute
https://bitbucket.org/pypy/pypy/issue/1982/ctypesstructure-subclasses-munge-_names

Ben Longbons:

The below code will print `{}` in python 2.7, 3.2, and 3.4, but `['foo', 
'bar']` in pypy 2.4.0 (in python2 or python3 mode).

If there is a reason to introduce new names, they should follow the ctypes 
`_sunder_` method.

(yeah, yeah, I should use `cffi`)

```
#!python
import ctypes

class Stuff(ctypes.Structure):
    __slots__ = ()
    _fields_ = [('foo', ctypes.c_int), ('bar', ctypes.c_int)]
    _names = {}

print(Stuff._names)
```



_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to