From d754d3b4c260b726a33d12b903c585bb7daeb3a7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 6 Nov 2017 09:56:43 -0500 Subject: [PATCH 1/3] 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 => mpio.h} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Modules/_decimal/libmpdec/{io.h => mpio.h} (100%) diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c index a45a429dbf1d39..099d3c857cf9e9 100644 --- a/Modules/_decimal/libmpdec/io.c +++ b/Modules/_decimal/libmpdec/io.c @@ -39,7 +39,7 @@ #include "constants.h" #include "memory.h" #include "typearith.h" -#include "io.h" +#include "mpio.h" /* This file contains functions for decimal <-> string conversions, including diff --git a/Modules/_decimal/libmpdec/io.h b/Modules/_decimal/libmpdec/mpio.h similarity index 100% rename from Modules/_decimal/libmpdec/io.h rename to Modules/_decimal/libmpdec/mpio.h From 174e8bcc2f474a4a4acb61707fe71b5bbc3c0e15 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 6 Nov 2017 10:37:50 -0500 Subject: [PATCH 2/3] 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 edc6cf4adbb495..c9b0049decc883 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; @@ -1517,7 +1517,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); @@ -1525,7 +1525,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 82969c6973381827a342b79e62e5d475b0c09226 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 6 Nov 2017 11:27:32 -0500 Subject: [PATCH 3/3] 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 593f9f5e03a5b3..808a835fcf79b9 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