From 9ec49ea39b57e69722d82b41594479a896c65ae2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 6 Nov 2017 21:44:29 -0500 Subject: [PATCH 1/4] Prevent incorrect include of "io.h" found in libmpdec directory This commit improves support for building python with built-in extensions on windows where the header provided by libmpdec would be included instead of the system one. --- Modules/_decimal/libmpdec/io.c | 2 +- Modules/_decimal/libmpdec/{io.h => mpd_io.h} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Modules/_decimal/libmpdec/{io.h => mpd_io.h} (100%) diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c index 3aadfb0437979c..1cc719a9263f69 100644 --- a/Modules/_decimal/libmpdec/io.c +++ b/Modules/_decimal/libmpdec/io.c @@ -38,7 +38,7 @@ #include "bits.h" #include "constants.h" #include "typearith.h" -#include "io.h" +#include "mpd_io.h" /* This file contains functions for decimal <-> string conversions, including diff --git a/Modules/_decimal/libmpdec/io.h b/Modules/_decimal/libmpdec/mpd_io.h similarity index 100% rename from Modules/_decimal/libmpdec/io.h rename to Modules/_decimal/libmpdec/mpd_io.h From d96bfdc9f531eaefdab931f6b2830278c2dc0226 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 6 Nov 2017 10:37:50 -0500 Subject: [PATCH 2/4] Prevent duplicated OverlappedType symbols with built-in extension on windows This commit improves support for building python with built-in extensions on windows where the symbol from overlapped.c would clash with the one from _winapi.c --- Modules/_winapi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 1606f0da772c95..d81215f89c70fa 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -147,7 +147,7 @@ overlapped_dealloc(OverlappedObject *self) /*[clinic input] module _winapi -class _winapi.Overlapped "OverlappedObject *" "&OverlappedType" +class _winapi.Overlapped "OverlappedObject *" "&WinApiOverlappedType" [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c13d3f5fd1dabb84]*/ @@ -295,7 +295,7 @@ static PyMemberDef overlapped_members[] = { {NULL} }; -PyTypeObject OverlappedType = { +PyTypeObject WinApiOverlappedType = { PyVarObject_HEAD_INIT(NULL, 0) /* tp_name */ "_winapi.Overlapped", /* tp_basicsize */ sizeof(OverlappedObject), @@ -341,7 +341,7 @@ new_overlapped(HANDLE handle) { OverlappedObject *self; - self = PyObject_New(OverlappedObject, &OverlappedType); + self = PyObject_New(OverlappedObject, &WinApiOverlappedType); if (!self) return NULL; self->handle = handle; @@ -1537,7 +1537,7 @@ PyInit__winapi(void) PyObject *d; PyObject *m; - if (PyType_Ready(&OverlappedType) < 0) + if (PyType_Ready(&WinApiOverlappedType) < 0) return NULL; m = PyModule_Create(&winapi_module); @@ -1545,7 +1545,7 @@ PyInit__winapi(void) return NULL; d = PyModule_GetDict(m); - PyDict_SetItemString(d, "Overlapped", (PyObject *) &OverlappedType); + PyDict_SetItemString(d, "Overlapped", (PyObject *) &WinApiOverlappedType); /* constants */ WINAPI_CONSTANT(F_DWORD, CREATE_NEW_CONSOLE); From 12cd7e4b43f85822d8ab0531cb3097e5f32bd5ff Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 6 Nov 2017 11:27:32 -0500 Subject: [PATCH 3/4] mpdecimal: Export inlined functions to support extension built-in on windows This commit ensures that symbols are available when building _freeze_importlib with all extensions built-in on windows. It addresses the following link error associated with CMakeBuild\libpython\_freeze_importlib.vcxproj: 3>_decimal.obj : error LNK2019: unresolved external symbol _mpd_del referenced in function _PyDec_AsTuple 3>io.obj : error LNK2001: unresolved external symbol _mpd_del 3>basearith.obj : error LNK2019: unresolved external symbol _mpd_uint_zero referenced in function __mpd_baseshiftl 3>io.obj : error LNK2019: unresolved external symbol _mpd_qresize referenced in function _mpd_qset_string --- Modules/_decimal/libmpdec/mpdecimal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c index 328ab9224628a4..5812bcd2ec2300 100644 --- a/Modules/_decimal/libmpdec/mpdecimal.c +++ b/Modules/_decimal/libmpdec/mpdecimal.c @@ -54,7 +54,7 @@ #if defined(_MSC_VER) - #define ALWAYS_INLINE __forceinline + #define ALWAYS_INLINE extern __forceinline #elif defined(LEGACY_COMPILER) #define ALWAYS_INLINE #undef inline From ca436844d5dddcb0156ada7fadc9fa4c38d8bcbe Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 12 Apr 2019 16:36:42 -0400 Subject: [PATCH 4/4] Fix Windows build of Python for latest WinSDK. This is a partial backport of https://github.com/python/cpython/commit/df4852cbe4b757e8b79506d73a09ec8a1b595970 --- Modules/_io/_iomodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c index f4d3cbd49f8bd7..f7ad1769905a9a 100644 --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -21,7 +21,7 @@ #endif /* HAVE_SYS_STAT_H */ #ifdef MS_WINDOWS -#include +#include #endif /* Various interned strings */