New issue 2703: PyPy3 bitfields reversed from expected value
https://bitbucket.org/pypy/pypy/issues/2703/pypy3-bitfields-reversed-from-expected

Holger Grund:

Bitfields in BigendianStructures are not allocated in the same way as for 
CPython on x86-64 Linux at least.

Per ABI big-endian bitfields should be allocated from high to low bit, but 
PyPy’s ctypes doesn’t do that. 

Observe:


```
#!python

import ctypes
class Foo(ctypes.BigEndianStructure):

  _fields_ = (
    ('first', ctypes.c_uint8, 4),
    ('second', ctypes.c_uint8, 4)) 

f = Foo(first=0,second=15)
print('%r' % list(bytes(f)))

```

PyPy3 prints [240].
CPython prints [15].


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

Reply via email to