diff options
author | Thomas Heller <theller@ctypes.org> | 2006-09-07 18:56:28 +0000 |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-09-07 18:56:28 +0000 |
commit | fdb62f0e5f0b7d1a70a9d8948768ff09ea420c41 (patch) | |
tree | 5dae99a7d879e5000f2a4e846c8f766287a4b62f /Lib | |
parent | 863f3d1fbff6b65eb0526f2d98a6f89474b96eb9 (diff) | |
download | cpython-git-fdb62f0e5f0b7d1a70a9d8948768ff09ea420c41.tar.gz |
Anonymous structure fields that have a bit-width specified did not work,
and they gave a strange error message from PyArg_ParseTuple:
function takes exactly 2 arguments (3 given).
With tests.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/test/test_bitfields.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py index 92c4669b2e..2867cbf93e 100644 --- a/Lib/ctypes/test/test_bitfields.py +++ b/Lib/ctypes/test/test_bitfields.py @@ -215,5 +215,14 @@ class BitFieldTest(unittest.TestCase): ("b", c_ubyte, 4)] self.failUnlessEqual(sizeof(X), sizeof(c_byte)) + def test_anon_bitfields(self): + # anonymous bit-fields gave a strange error message + class X(Structure): + _fields_ = [("a", c_byte, 4), + ("b", c_ubyte, 4)] + class Y(Structure): + _anonymous_ = ["_"] + _fields_ = [("_", X)] + if __name__ == "__main__": unittest.main() |