MINGW-packages/mingw-w64-python2/1900-ctypes-dont-depend-on-internal-libffi.patch
2019-03-07 10:38:39 +03:00

25 lines
619 B
Diff

--- Python-3.7.1/Modules/_ctypes/callproc.c.orig 2018-10-21 20:21:21.305822500 +0200
+++ Python-3.7.1/Modules/_ctypes/callproc.c 2018-10-21 20:51:03.252890200 +0200
@@ -701,6 +701,21 @@
}
}
+#ifdef __MINGW32__
+/*
+Per: https://msdn.microsoft.com/en-us/library/7572ztz4.aspx
+To be returned by value in RAX, user-defined types must have a length
+of 1, 2, 4, 8, 16, 32, or 64 bits
+*/
+static int can_return_struct_as_int(size_t s)
+{
+ return s == 1 || s == 2 || s == 4;
+}
+static int can_return_struct_as_sint64(size_t s)
+{
+ return s == 8;
+}
+#endif
ffi_type *_ctypes_get_ffi_type(PyObject *obj)
{