summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2012-07-19 05:01:22 (GMT)
committerMeador Inge <meadori@gmail.com>2012-07-19 05:01:22 (GMT)
commit60c2266afe82daab47779deed6f701902943d20e (patch)
treec15f4f32a4a0893c8a51a76954f1755f8532215a /Lib
parent996ae049436c868a91c755a578c42957d35ce2b9 (diff)
downloadcpython-60c2266afe82daab47779deed6f701902943d20e.zip
cpython-60c2266afe82daab47779deed6f701902943d20e.tar.gz
cpython-60c2266afe82daab47779deed6f701902943d20e.tar.bz2
Issue #6493: Fix handling of c_uint32 bitfields with width of 32 on Windows.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/test/test_bitfields.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py
index 9e0825c..28c8795 100644
--- a/Lib/ctypes/test/test_bitfields.py
+++ b/Lib/ctypes/test/test_bitfields.py
@@ -240,5 +240,25 @@ class BitFieldTest(unittest.TestCase):
_anonymous_ = ["_"]
_fields_ = [("_", X)]
+ @unittest.skipUnless(hasattr(ctypes, "c_uint32"), "c_int32 is required")
+ def test_uint32(self):
+ class X(Structure):
+ _fields_ = [("a", c_uint32, 32)]
+ x = X()
+ x.a = 10
+ self.assertEquals(x.a, 10)
+ x.a = 0xFDCBA987
+ self.assertEquals(x.a, 0xFDCBA987)
+
+ @unittest.skipUnless(hasattr(ctypes, "c_uint64"), "c_int64 is required")
+ def test_uint64(self):
+ class X(Structure):
+ _fields_ = [("a", c_uint64, 64)]
+ x = X()
+ x.a = 10
+ self.assertEquals(x.a, 10)
+ x.a = 0xFEDCBA9876543211
+ self.assertEquals(x.a, 0xFEDCBA9876543211)
+
if __name__ == "__main__":
unittest.main()