Tommy Sparber added the comment:
This bug is still present using Python 3.7.
I'm also not sure how to fix the leakage of the internal bitfield size encoding.
--
nosy: +tsparber
versions: +Python 3.5, Python 3.6, Python 3.7
___
Python tracker
Meador Inge added the comment:
OK, I finally had some time to look at this. The attached patch does fix the
issue. However, it has a nasty side effect in that the encoded bitfield size
stays with the field member object:
class SubByte(c_ubyte): pass
...
class A(Structure):
New submission from Thomas Heller thel...@ctypes.org:
When a ctypes Structure uses a subclass of c_int, c_short, c_byte in the
_fields_ list to define bitfields, the results are wrong.
The attached script showbug.py demonstrates this behaviour.
--
components: ctypes
files: showbug.py
Thomas Heller thel...@ctypes.org added the comment:
The attached patch for branch default fixes this issue. It also contains a
unittest.
--
Added file: http://bugs.python.org/file26530/bitfields.patch
___
Python tracker rep...@bugs.python.org
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15459
___
Changes by Éric Araujo mer...@netwok.org:
--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge
stage: - patch review
versions: +Python 3.2 -Python 3.4
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15459