diff options
author | Thomas Heller <theller@ctypes.org> | 2008-09-24 18:26:05 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2008-09-24 18:26:05 (GMT) |
commit | a85c95d5e85e1d6886d1260b88221c2a31686a55 (patch) | |
tree | cfedbc3bc8888d127de4e0c4a133105da3630bcf /Lib/ctypes | |
parent | 8798c90df2b2d77ddb76611c0ea4be463c543f2b (diff) | |
download | cpython-a85c95d5e85e1d6886d1260b88221c2a31686a55.zip cpython-a85c95d5e85e1d6886d1260b88221c2a31686a55.tar.gz cpython-a85c95d5e85e1d6886d1260b88221c2a31686a55.tar.bz2 |
Fix issue #3547: ctypes is confused by bitfields of varying integer types
Reviewed by Fredrik Lundh and Skip Montanaro.
Diffstat (limited to 'Lib/ctypes')
-rw-r--r-- | Lib/ctypes/test/test_bitfields.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py index 2867cbf..ddd753e 100644 --- a/Lib/ctypes/test/test_bitfields.py +++ b/Lib/ctypes/test/test_bitfields.py @@ -215,6 +215,21 @@ class BitFieldTest(unittest.TestCase): ("b", c_ubyte, 4)] self.failUnlessEqual(sizeof(X), sizeof(c_byte)) + def test_mixed_4(self): + class X(Structure): + _fields_ = [("a", c_short, 4), + ("b", c_short, 4), + ("c", c_int, 24), + ("d", c_short, 4), + ("e", c_short, 4), + ("f", c_int, 24)] + # MS compilers do NOT combine c_short and c_int into + # one field, gcc does. + if os.name in ("nt", "ce"): + self.failUnlessEqual(sizeof(X), sizeof(c_int) * 4) + else: + self.failUnlessEqual(sizeof(X), sizeof(c_int) * 2) + def test_anon_bitfields(self): # anonymous bit-fields gave a strange error message class X(Structure): |