diff -rupN Python-2.7.13/Python/sysmodule.c Python-2.7.13-new/Python/sysmodule.c
--- Python-2.7.13/Python/sysmodule.c 2016-12-17 21:05:07.000000000 +0100
+++ Python-2.7.13-new/Python/sysmodule.c 2017-01-21 01:46:14.459522645 +0100
@@ -27,7 +27,7 @@ Data members:
#include "windows.h"
#endif /* MS_WINDOWS */
-#ifdef MS_COREDLL
+#if defined(MS_WINDOWS) && defined(Py_ENABLE_SHARED)
extern void *PyWin_DLLhModule;
/* A string loaded from the DLL at startup: */
extern const char *PyWin_DLLVersionString;
@@ -1473,7 +1473,7 @@ _PySys_Init(void)
SET_SYS_FROM_STRING("byteorder",
PyString_FromString(value));
}
-#ifdef MS_COREDLL
+#if defined(MS_WINDOWS) && defined(Py_ENABLE_SHARED)
SET_SYS_FROM_STRING("dllhandle",
PyLong_FromVoidPtr(PyWin_DLLhModule));
SET_SYS_FROM_STRING("winver",