forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python3: fix ctypes module build. Fixes msys2#4572
python/cpython#9258 changed callproc to use functions from the internal libffi which we don't use. Just copy the functions into callproc directly instead.
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
mingw-w64-python3/1900-ctypes-dont-depend-on-internal-libffi.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
See https:/python/cpython/pull/9258 | ||
--- Python-3.7.1/Modules/_ctypes/callproc.c.orig 2018-10-20 08:04:19.000000000 +0200 | ||
+++ Python-3.7.1/Modules/_ctypes/callproc.c 2018-10-21 20:15:23.737316400 +0200 | ||
@@ -701,6 +701,19 @@ | ||
} | ||
} | ||
|
||
+/* | ||
+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; | ||
+} | ||
|
||
ffi_type *_ctypes_get_ffi_type(PyObject *obj) | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters