diff options
author | Miss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-10-19 22:29:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-19 22:29:37 (GMT) |
commit | 6e998fad1c92aee9c8c23c5887a7023d76bdf6c2 (patch) | |
tree | f9aaa0addb7cea3db8e5b9642365792315aee679 /Modules | |
parent | dc785db64d55c3d7a69b10c303e6386e87cfd01b (diff) | |
download | cpython-6e998fad1c92aee9c8c23c5887a7023d76bdf6c2.zip cpython-6e998fad1c92aee9c8c23c5887a7023d76bdf6c2.tar.gz cpython-6e998fad1c92aee9c8c23c5887a7023d76bdf6c2.tar.bz2 |
bpo-16396: Allow wintypes to be imported on non-Windows systems. (GH-21394)
Co-authored-by: Christian Heimes <christian@python.org>
(cherry picked from commit 5456e78f4593edc277ab72fb9a9db1ebae7d4c2d)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/cfield.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index 95367d5..1a36356 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -695,7 +695,11 @@ i_get_sw(void *ptr, Py_ssize_t size) 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) @@ -717,7 +721,6 @@ vBOOL_get(void *ptr, Py_ssize_t size) { return PyBool_FromLong((long)*(short int *)ptr); } -#endif static PyObject * bool_set(void *ptr, PyObject *value, Py_ssize_t size) @@ -1544,8 +1547,8 @@ static struct fielddesc formattable[] = { #endif #ifdef MS_WIN32 { 'X', BSTR_set, BSTR_get, &ffi_type_pointer}, - { 'v', vBOOL_set, vBOOL_get, &ffi_type_sshort}, #endif + { 'v', vBOOL_set, vBOOL_get, &ffi_type_sshort}, #if SIZEOF__BOOL == 1 { '?', bool_set, bool_get, &ffi_type_uchar}, /* Also fallback for no native _Bool support */ #elif SIZEOF__BOOL == SIZEOF_SHORT |