[Python-checkins] r74147 - in python/trunk: Lib/ctypes/test/test_bitfields.py Misc/NEWS Modules/_ctypes/cfield.c

thomas.heller python-checkins at python.org
Tue Jul 21 21:04:02 CEST 2009


Author: thomas.heller
Date: Tue Jul 21 21:04:02 2009
New Revision: 74147

Log:
Revert rev 74134, as it does not completely fixx issue #6493.

Modified:
   python/trunk/Lib/ctypes/test/test_bitfields.py
   python/trunk/Misc/NEWS
   python/trunk/Modules/_ctypes/cfield.c

Modified: python/trunk/Lib/ctypes/test/test_bitfields.py
==============================================================================
--- python/trunk/Lib/ctypes/test/test_bitfields.py	(original)
+++ python/trunk/Lib/ctypes/test/test_bitfields.py	Tue Jul 21 21:04:02 2009
@@ -240,20 +240,5 @@
             _anonymous_ = ["_"]
             _fields_ = [("_", X)]
 
-    def test_uint32(self):
-        class X(Structure):
-            _fields_ = [("a", c_uint32, 32)]
-        x = X()
-        x.a = 10
-        self.failUnlessEqual(x.a, 10)
-
-    def test_uint64(self):
-        class X(Structure):
-            _fields_ = [("a", c_uint64, 64)]
-        x = X()
-        x.a = 10
-        self.failUnlessEqual(x.a, 10)
-
-
 if __name__ == "__main__":
     unittest.main()

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Jul 21 21:04:02 2009
@@ -349,8 +349,6 @@
 Library
 -------
 
-- Issue #6493: Fix a ctypes problem setting bitfields more than 31 bits wide.
-
 - unittest has been split up into a package.  All old names should still work.
 
 - Issue #6431: Make Fraction type return NotImplemented when it doesn't

Modified: python/trunk/Modules/_ctypes/cfield.c
==============================================================================
--- python/trunk/Modules/_ctypes/cfield.c	(original)
+++ python/trunk/Modules/_ctypes/cfield.c	Tue Jul 21 21:04:02 2009
@@ -426,9 +426,9 @@
 #define LOW_BIT(x)  ((x) & 0xFFFF)
 #define NUM_BITS(x) ((x) >> 16)
 
-/* This seems more a compiler issue than a Windows/non-Windows one */
+/* This seems nore a compiler issue than a Windows/non-Windows one */
 #ifdef MS_WIN32
-#  define BIT_MASK(size) ((1i64 << NUM_BITS(size))-1)
+#  define BIT_MASK(size) ((1 << NUM_BITS(size))-1)
 #else
 #  define BIT_MASK(size) ((1LL << NUM_BITS(size))-1)
 #endif


More information about the Python-checkins mailing list