Discussion:
[Python-3000-checkins] r66684 - in python/branches/py3k: Lib/ctypes/test/test_bitfields.py Modules/_ctypes/cfield.c
thomas.heller
2008-09-29 20:03:54 UTC
Permalink
Author: thomas.heller
Date: Mon Sep 29 22:03:53 2008
New Revision: 66684

Log:
Merged revisions 66683 via svnmerge from
svn+ssh://pythondev at 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.
........


Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/ctypes/test/test_bitfields.py
python/branches/py3k/Modules/_ctypes/cfield.c

Modified: python/branches/py3k/Lib/ctypes/test/test_bitfields.py
==============================================================================
--- python/branches/py3k/Lib/ctypes/test/test_bitfields.py (original)
+++ python/branches/py3k/Lib/ctypes/test/test_bitfields.py Mon Sep 29 22:03:53 2008
@@ -223,8 +223,9 @@
("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:

Modified: python/branches/py3k/Modules/_ctypes/cfield.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/cfield.c (original)
+++ python/branches/py3k/Modules/_ctypes/cfield.c Mon Sep 29 22:03:53 2008
@@ -61,10 +61,12 @@
}
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 */

Loading...