diff --git a/Lib/ctypes/test/test_wintypes.py b/Lib/ctypes/test/test_wintypes.py --- a/Lib/ctypes/test/test_wintypes.py +++ b/Lib/ctypes/test/test_wintypes.py @@ -1,8 +1,7 @@ import sys import unittest -if not sys.platform.startswith('win'): - raise unittest.SkipTest('Windows-only test') +# also work on POSIX from ctypes import * from ctypes import wintypes diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -691,7 +691,11 @@ return PyLong_FromLong(val); } -#ifdef MS_WIN32 +#ifndef MS_WIN32 +/* http://msdn.microsoft.com/en-us/library/cc237864.aspx */ +#define VARIANT_FALSE 0x0000 +#define VARIANT_TRUE 0xFFFF +#endif /* short BOOL - VARIANT_BOOL */ static PyObject * vBOOL_set(void *ptr, PyObject *value, Py_ssize_t size) @@ -713,7 +717,6 @@ { return PyBool_FromLong((long)*(short int *)ptr); } -#endif #ifdef HAVE_C99_BOOL #define BOOL_TYPE _Bool @@ -1576,8 +1579,8 @@ #endif #ifdef MS_WIN32 { 'X', BSTR_set, BSTR_get, &ffi_type_pointer}, +#endif { 'v', vBOOL_set, vBOOL_get, &ffi_type_sshort}, -#endif #if SIZEOF__BOOL == 1 { '?', bool_set, bool_get, &ffi_type_uchar}, /* Also fallback for no native _Bool support */ #elif SIZEOF__BOOL == SIZEOF_SHORT