summaryrefslogtreecommitdiff
path: root/Modules/_ctypes
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-08-02 18:02:59 +0200
committerGitHub <noreply@github.com>2018-08-02 18:02:59 +0200
commitdd4d8b4d80065409dae69f966fd7617e5b3d97f1 (patch)
tree60ff84dc2c66cf4f098f28e9387bcb91aa1b3908 /Modules/_ctypes
parent6a6b2483479a1ad0ab82300452f0ce71fa90b2d7 (diff)
downloadcpython-git-dd4d8b4d80065409dae69f966fd7617e5b3d97f1.tar.gz
Fix compilation warnings on Windows (GH-8627)
* Fix compilation warning in _ctypes module on Window (cherry picked from commit 20f11fe43c47b68c8b9dd6539d2d40b66c9957f9) * Fix compilation warnings on Windows 64-bit (cherry picked from commit 725e4212229bf68f87d4f66c1815d444ddfc7aa5) * Fix compiler warning in unicodeobject.c Explicitly case to Py_UNICODE to fix the warning: Objects\unicodeobject.c(4225): warning C4244: '=' : conversion from 'long' to 'Py_UNICODE', possible loss of data The downcast cannot overflow since we check that value <= 0x10ffff.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r--Modules/_ctypes/libffi_msvc/ffi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_ctypes/libffi_msvc/ffi.c b/Modules/_ctypes/libffi_msvc/ffi.c
index f28c3e0a38..587c94b7e6 100644
--- a/Modules/_ctypes/libffi_msvc/ffi.c
+++ b/Modules/_ctypes/libffi_msvc/ffi.c
@@ -119,7 +119,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
argp += z;
}
- if (argp - stack > ecif->cif->bytes)
+ if (argp >= stack && (unsigned)(argp - stack) > ecif->cif->bytes)
{
Py_FatalError("FFI BUG: not enough stack space for arguments");
}