]> granicus.if.org Git - python/commitdiff
Merged revisions 66683 via svnmerge from
authorThomas Heller <theller@ctypes.org>
Mon, 29 Sep 2008 20:03:53 +0000 (20:03 +0000)
committerThomas Heller <theller@ctypes.org>
Mon, 29 Sep 2008 20:03:53 +0000 (20:03 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66683 | thomas.heller | 2008-09-29 21:56:24 +0200 (Mo, 29 Sep 2008) | 1 line

  Fix issue #3547 for MingW, update comments.
........

Lib/ctypes/test/test_bitfields.py
Modules/_ctypes/cfield.c

index 06c4023fa2d18f2e6226e52b1dc3cdc5165c862e..de1c619ab3ee20c1edf88d54504174c64aa966b4 100644 (file)
@@ -223,8 +223,9 @@ class BitFieldTest(unittest.TestCase):
                         ("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.
+        # MSVC does NOT combine c_short and c_int into one field, GCC
+        # does (unless GCC is run with '-mms-bitfields' which
+        # produces code compatible with MSVC).
         if os.name in ("nt", "ce"):
             self.failUnlessEqual(sizeof(X), sizeof(c_int) * 4)
         else:
index 9040dbb13500d22f36220220a792885f5f11a492..b6f41fe00a18c8f5e5ac9d6ac364c7ff4a719e39 100644 (file)
@@ -61,10 +61,12 @@ CField_FromDesc(PyObject *desc, Py_ssize_t index,
        }
        if (bitsize /* this is a bitfield request */
            && *pfield_size /* we have a bitfield open */
-#if defined(MS_WIN32) && !defined(__MINGW32__)
-           && dict->size * 8 == *pfield_size /* MSVC */
+#ifdef MS_WIN32
+           /* MSVC, GCC with -mms-bitfields */
+           && dict->size * 8 == *pfield_size
 #else
-           && dict->size * 8 <= *pfield_size /* GCC, MINGW */
+           /* GCC */
+           && dict->size * 8 <= *pfield_size 
 #endif
            && (*pbitofs + bitsize) <= *pfield_size) {
                /* continue bit field */