[pypy-issue] [issue1232] bugs in pypy ctypes

Pierpaolo Paolucci tracker at bugs.pypy.org
Tue Aug 7 21:26:11 CEST 2012


New submission from Pierpaolo Paolucci <pierpaolo.paolucci at idemnet.it>:

from ctypes import *
class enum(c_uint):
    def __new__(cls, value):
        values = [getattr(cls, x) for x in dir(cls) if x.isupper()]
        if not value in values:
            raise ValueError, 'value <%d> not in %s' % (value, sorted(values))
        return super(enum, cls).__new__(cls)
class t_t(enum):
    (K, M, D, C) = map(int, xrange(4))
class DonaldDuck(Structure):
    _fields_ = [ ('t', t_t), ]
D = DonaldDuck()
print D.t
# this work perfectly on cpython but not on pypy 1.9

----------
files: pypy_ctype_bug.py
messages: 4640
nosy: peeble, pypy-issue
priority: bug
status: unread
title: bugs in pypy ctypes

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1232>
________________________________________


More information about the pypy-issue mailing list