Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28acc6c

Browse files
author
Thomas Heller
committed
Merged revisions 66683 via svnmerge from
svn+ssh://[email protected]/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. ........
1 parent 4970215 commit 28acc6c

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

Lib/ctypes/test/test_bitfields.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,9 @@ class X(Structure):
223223
("d", c_short, 4),
224224
("e", c_short, 4),
225225
("f", c_int, 24)]
226-
# MS compilers do NOT combine c_short and c_int into
227-
# one field, gcc does.
226+
# MSVC does NOT combine c_short and c_int into one field, GCC
227+
# does (unless GCC is run with '-mms-bitfields' which
228+
# produces code compatible with MSVC).
228229
if os.name in ("nt", "ce"):
229230
self.failUnlessEqual(sizeof(X), sizeof(c_int) * 4)
230231
else:

Modules/_ctypes/cfield.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ CField_FromDesc(PyObject *desc, Py_ssize_t index,
6161
}
6262
if (bitsize /* this is a bitfield request */
6363
&& *pfield_size /* we have a bitfield open */
64-
#if defined(MS_WIN32) && !defined(__MINGW32__)
65-
&& dict->size * 8 == *pfield_size /* MSVC */
64+
#ifdef MS_WIN32
65+
/* MSVC, GCC with -mms-bitfields */
66+
&& dict->size * 8 == *pfield_size
6667
#else
67-
&& dict->size * 8 <= *pfield_size /* GCC, MINGW */
68+
/* GCC */
69+
&& dict->size * 8 <= *pfield_size
6870
#endif
6971
&& (*pbitofs + bitsize) <= *pfield_size) {
7072
/* continue bit field */

0 commit comments

Comments
 (0)