From f4641dffd632266c4752fda347135bd8e0aed96f Mon Sep 17 00:00:00 2001 From: Frederick Price Date: Wed, 26 Jun 2024 01:20:51 -0400 Subject: [PATCH 01/11] Fix import error caused by importing WSAE* error codes on Unix From d3c6461bf80260177f30479af97df52b60efa2d3 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 8 Aug 2024 18:03:57 -0500 Subject: [PATCH 02/11] Add VCRUNTIME dlls to the main python folder --- PC/layout/support/python.props | 1 + 1 file changed, 1 insertion(+) diff --git a/PC/layout/support/python.props b/PC/layout/support/python.props index 4a4ed47c08564c..75007b60056987 100644 --- a/PC/layout/support/python.props +++ b/PC/layout/support/python.props @@ -30,6 +30,7 @@ <_PythonRuntimeExe Include="$(PythonHome)\python*.dll" /> + <_PythonRuntimeExe Include="$(PythonHome)\vcruntime*.dll" /> <_PythonRuntimeExe Include="$(PythonHome)\python*.exe" Condition="$(IncludePythonExe) == 'true'" /> <_PythonRuntimeExe> %(Filename)%(Extension) From 3efa80d546e46a4b3e340309090fd3660297aadb Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 8 Aug 2024 23:43:06 -0500 Subject: [PATCH 03/11] bpo-36778: cp65001 encoding becomes an alias to utf_8 (GH-13230) --- Doc/library/codecs.rst | 2 ++ Lib/encodings/aliases.py | 1 + 2 files changed, 3 insertions(+) diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 4fd0951e304a74..e1ec268066892b 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -1006,6 +1006,8 @@ particular, the following variants typically exist: +-----------------+--------------------------------+--------------------------------+ | cp1258 | windows-1258 | Vietnamese | +-----------------+--------------------------------+--------------------------------+ +| cp65001 | | Alias to ``utf_8`` encoding | ++-----------------+--------------------------------+--------------------------------+ | euc_jp | eucjp, ujis, u-jis | Japanese | +-----------------+--------------------------------+--------------------------------+ | euc_jis_2004 | jisx0213, eucjis2004 | Japanese | diff --git a/Lib/encodings/aliases.py b/Lib/encodings/aliases.py index a54cf774b7b1dd..c752683fcea256 100644 --- a/Lib/encodings/aliases.py +++ b/Lib/encodings/aliases.py @@ -516,6 +516,7 @@ 'utf8' : 'utf_8', 'utf8_ucs2' : 'utf_8', 'utf8_ucs4' : 'utf_8', + 'cp65001' : 'utf_8', # uu_codec codec 'uu' : 'uu_codec', From 813c5d115982fd407decc8eb6a660c196c719b26 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Thu, 8 Aug 2024 23:45:14 -0500 Subject: [PATCH 04/11] Release 2.7.18.10 Update News and patch level. --- Include/patchlevel.h | 2 +- Misc/NEWS.d/2.7.18.10.rst | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/2.7.18.10.rst diff --git a/Include/patchlevel.h b/Include/patchlevel.h index d250bb8e4dcdb5..9a0c45e13d9bd0 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -27,7 +27,7 @@ #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.7.18.9" +#define PY_VERSION "2.7.18.10" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS.d/2.7.18.10.rst b/Misc/NEWS.d/2.7.18.10.rst new file mode 100644 index 00000000000000..7281381f4585a2 --- /dev/null +++ b/Misc/NEWS.d/2.7.18.10.rst @@ -0,0 +1,43 @@ +.. bpo: none +.. date: 2024-08-08 +.. nonce: +.. release date: 2024-08-08 +.. section: Core and Builtins + +Relocate vcruntime140.dll to Python executable folder. + +vcruntime140.dll has been moved to the same directory as Python.exe. + +.. bpo: none +.. date: 2024-08-08 +.. nonce: +.. release date: 2024-06-26 +.. section: Core and Builtins + +WSA Errors are handled on Unix + +We now convert WSAE* errors to unix equvalents if they are not supported. + +.. bpo: 36778 +.. date: 2019-05-10 +.. nonce: +.. release date: 2024-06-06 +.. section: Core and Builtins + +Handle Windows code page 65001 + +``cp65001`` encoding (Windows code page 65001) becomes an alias to ``utf_8`` +encoding. + +.. gh: 114315 +.. date: 2024-06-27 +.. nonce: +.. release date: 2024-08-08 +.. section: Core and Builtins + +CVE-2024-0397 Fix locking in cert_store_stats and get_ca_certs + +:meth:`ssl.SSLContext.cert_store_stats` and +:meth:`ssl.SSLContext.get_ca_certs` now correctly lock access to the +certificate store, when the :class:`ssl.SSLContext` is shared across +multiple threads. From 5f837f0885a3551eec739ea9382d39de517462bc Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Fri, 9 Aug 2024 14:12:20 -0500 Subject: [PATCH 05/11] Port the Windows build from VS2008 Based off of: https://github.com/ActiveState/cpython/commit/401f9f3d32dcebf5ead8079d46a83fe7c7631581 and https://github.com/python-cmake-buildsystem/cpython/commit/97fa07cf35f41fa72c34edc0fbaf5cd65e2c83a9 --- Lib/distutils/command/build_ext.py | 2 +- Lib/distutils/msvc9compiler.py | 9 ++--- Modules/errnomodule.c | 27 ++++++++++++++ Objects/exceptions.c | 56 ++++++++++++++++++++++++++++++ PC/dl_nt.c | 18 +++++++--- PC/msvcrtmodule.c | 15 +++++++- PC/pyconfig.h | 9 +++-- Python/dynload_win.c | 17 ++++++--- 8 files changed, 135 insertions(+), 18 deletions(-) diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 86a85c1a0a01da..65a60b5c72b893 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -193,7 +193,7 @@ def finalize_options(self): # Append the source distribution include and library directories, # this allows distutils on windows to work in the source tree self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) - if MSVC_VERSION == 9: + if MSVC_VERSION >= 9: # Use the .lib files for the correct architecture if self.plat_name == 'win32': suffix = '' diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py index 785e555566c656..6cb5ef7a2449d5 100644 --- a/Lib/distutils/msvc9compiler.py +++ b/Lib/distutils/msvc9compiler.py @@ -716,11 +716,12 @@ def link(self, if mfinfo is not None: mffilename, mfid = mfinfo out_arg = '-outputresource:%s;%s' % (output_filename, mfid) - try: - self.spawn(['mt.exe', '-nologo', '-manifest', + if self.__version < 10: + try: + self.spawn(['mt.exe', '-nologo', '-manifest', mffilename, out_arg]) - except DistutilsExecError, msg: - raise LinkError(msg) + except DistutilsExecError, msg: + raise LinkError(msg) else: log.debug("skipping %s (up-to-date)", output_filename) diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c index 87ebab013a0b7c..90fddac6e310dd 100644 --- a/Modules/errnomodule.c +++ b/Modules/errnomodule.c @@ -6,6 +6,33 @@ /* Windows socket errors (WSA*) */ #ifdef MS_WINDOWS #include +/* The following constants were added to errno.h in VS2010 but have + preferred WSA equivalents. */ +#undef EADDRINUSE +#undef EADDRNOTAVAIL +#undef EAFNOSUPPORT +#undef EALREADY +#undef ECONNABORTED +#undef ECONNREFUSED +#undef ECONNRESET +#undef EDESTADDRREQ +#undef EHOSTUNREACH +#undef EINPROGRESS +#undef EISCONN +#undef ELOOP +#undef EMSGSIZE +#undef ENETDOWN +#undef ENETRESET +#undef ENETUNREACH +#undef ENOBUFS +#undef ENOPROTOOPT +#undef ENOTCONN +#undef ENOTSOCK +#undef EOPNOTSUPP +#undef EPROTONOSUPPORT +#undef EPROTOTYPE +#undef ETIMEDOUT +#undef EWOULDBLOCK #endif /* diff --git a/Objects/exceptions.c b/Objects/exceptions.c index fc601521208155..318aa12f86f91a 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2042,6 +2042,62 @@ static PyMethodDef functions[] = { if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \ Py_FatalError("Module dictionary insertion problem."); +#ifdef MS_WINDOWS +#include +/* The following constants were added to errno.h in VS2010 but have + preferred WSA equivalents. */ +#undef EADDRINUSE +#undef EADDRNOTAVAIL +#undef EAFNOSUPPORT +#undef EALREADY +#undef ECONNABORTED +#undef ECONNREFUSED +#undef ECONNRESET +#undef EDESTADDRREQ +#undef EHOSTUNREACH +#undef EINPROGRESS +#undef EISCONN +#undef ELOOP +#undef EMSGSIZE +#undef ENETDOWN +#undef ENETRESET +#undef ENETUNREACH +#undef ENOBUFS +#undef ENOPROTOOPT +#undef ENOTCONN +#undef ENOTSOCK +#undef EOPNOTSUPP +#undef EPROTONOSUPPORT +#undef EPROTOTYPE +#undef ETIMEDOUT +#undef EWOULDBLOCK + +#if defined(WSAEALREADY) && !defined(EALREADY) +#define EALREADY WSAEALREADY +#endif +#if defined(WSAECONNABORTED) && !defined(ECONNABORTED) +#define ECONNABORTED WSAECONNABORTED +#endif +#if defined(WSAECONNREFUSED) && !defined(ECONNREFUSED) +#define ECONNREFUSED WSAECONNREFUSED +#endif +#if defined(WSAECONNRESET) && !defined(ECONNRESET) +#define ECONNRESET WSAECONNRESET +#endif +#if defined(WSAEINPROGRESS) && !defined(EINPROGRESS) +#define EINPROGRESS WSAEINPROGRESS +#endif +#if defined(WSAESHUTDOWN) && !defined(ESHUTDOWN) +#define ESHUTDOWN WSAESHUTDOWN +#endif +#if defined(WSAETIMEDOUT) && !defined(ETIMEDOUT) +#define ETIMEDOUT WSAETIMEDOUT +#endif +#if defined(WSAEWOULDBLOCK) && !defined(EWOULDBLOCK) +#define EWOULDBLOCK WSAEWOULDBLOCK +#endif +#endif /* MS_WINDOWS */ + PyMODINIT_FUNC _PyExc_Init(void) diff --git a/PC/dl_nt.c b/PC/dl_nt.c index 3e58bacb55ff2c..6923b6e173b438 100644 --- a/PC/dl_nt.c +++ b/PC/dl_nt.c @@ -18,7 +18,8 @@ char dllVersionBuffer[16] = ""; // a private buffer HMODULE PyWin_DLLhModule = NULL; const char *PyWin_DLLVersionString = dllVersionBuffer; -// Windows "Activation Context" work: +#if HAVE_SXS +// Windows "Activation Context" work. // Our .pyd extension modules are generally built without a manifest (ie, // those included with Python and those built with a default distutils. // This requires we perform some "activation context" magic when loading our @@ -29,6 +30,8 @@ const char *PyWin_DLLVersionString = dllVersionBuffer; // As an added complication, this magic only works on XP or later - we simply // use the existence (or not) of the relevant function pointers from kernel32. // See bug 4566 (http://python.org/sf/4566) for more details. +// In Visual Studio 2010, side by side assemblies are no longer used by +// default. typedef BOOL (WINAPI * PFN_GETCURRENTACTCTX)(HANDLE *); typedef BOOL (WINAPI * PFN_ACTIVATEACTCTX)(HANDLE, ULONG_PTR *); @@ -75,6 +78,7 @@ void _Py_DeactivateActCtx(ULONG_PTR cookie) if (!(*pfnDeactivateActCtx)(0, cookie)) OutputDebugString("Python failed to de-activate the activation context\n"); } +#endif /* HAVE_SXS */ BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, @@ -87,7 +91,8 @@ BOOL WINAPI DllMain (HANDLE hInst, // 1000 is a magic number I picked out of the air. Could do with a #define, I spose... LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer)); - // and capture our activation context for use when loading extensions. +#if HAVE_SXS + // and capture our activation context for use when loading extensions. _LoadActCtxPointers(); if (pfnGetCurrentActCtx && pfnAddRefActCtx) if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext)) { @@ -96,14 +101,17 @@ BOOL WINAPI DllMain (HANDLE hInst, else { OutputDebugString("Python failed to load the default " "activation context\n"); - return FALSE; +#endif + return FALSE; } break; case DLL_PROCESS_DETACH: - if (pfnReleaseActCtx) +#if HAVE_SXS + if (pfnReleaseActCtx) (*pfnReleaseActCtx)(PyWin_DLLhActivationContext); - break; +#endif + break; } return TRUE; } diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index d4d62ab5cc8574..bf3ad93ccc5265 100644 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -25,6 +25,8 @@ #ifdef _MSC_VER #if _MSC_VER >= 1500 && _MSC_VER < 1600 #include +#elif _MSC_VER >= 1600 +#include #endif #endif @@ -397,7 +399,7 @@ PyMODINIT_FUNC initmsvcrt(void) { int st; - PyObject *d; + PyObject *d, *version; PyObject *m = Py_InitModule("msvcrt", msvcrt_functions); if (m == NULL) return; @@ -411,6 +413,7 @@ initmsvcrt(void) insertint(d, "LK_UNLCK", _LK_UNLCK); /* constants for the crt versions */ + (void)st; #ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN", _VC_ASSEMBLY_PUBLICKEYTOKEN); @@ -426,4 +429,14 @@ initmsvcrt(void) __LIBRARIES_ASSEMBLY_NAME_PREFIX); if (st < 0)return; #endif + + /* constants for the 2010 crt versions */ +#if defined(_VC_CRT_MAJOR_VERSION) && defined (_VC_CRT_MINOR_VERSION) && defined(_VC_CRT_BUILD_VERSION) && defined(_VC_CRT_RBUILD_VERSION) + version = PyUnicode_FromFormat("%d.%d.%d.%d", _VC_CRT_MAJOR_VERSION, + _VC_CRT_MINOR_VERSION, + _VC_CRT_BUILD_VERSION, + _VC_CRT_RBUILD_VERSION); + st = PyModule_AddObject(m, "CRT_ASSEMBLY_VERSION", version); + if (st < 0) return NULL; +#endif } diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 5fa6398793178a..0cbd236d945bb8 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -226,14 +226,19 @@ typedef int pid_t; #define Py_IS_FINITE(X) _finite(X) #define copysign _copysign -#endif /* _MSC_VER */ +/* Side by Side assemblies supported in VS 2005 and VS 2008 but not 2010*/ +#if _MSC_VER >= 1400 && _MSC_VER < 1600 +#define HAVE_SXS 1 +#endif /* define some ANSI types that are not defined in earlier Win headers */ -#if defined(_MSC_VER) && _MSC_VER >= 1200 +#if _MSC_VER >= 1200 /* This file only exists in VC 6.0 or higher */ #include #endif +#endif /* _MSC_VER */ + /* ------------------------------------------------------------------------*/ /* The Borland compiler defines __BORLANDC__ */ /* XXX These defines are likely incomplete, but should be easy to fix. */ diff --git a/Python/dynload_win.c b/Python/dynload_win.c index 4e5555e917fc58..018adb0e77210d 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -12,9 +12,10 @@ #include // "activation context" magic - see dl_nt.c... +#if HAVE_SXS extern ULONG_PTR _Py_ActivateActCtx(); void _Py_DeactivateActCtx(ULONG_PTR cookie); - +#endif const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef _DEBUG {"_d.pyd", "rb", C_EXTENSION}, @@ -176,8 +177,10 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, char pathbuf[260]; LPTSTR dummy; unsigned int old_mode; - ULONG_PTR cookie = 0; - /* We use LoadLibraryEx so Windows looks for dependent DLLs +#if HAVE_SXS + ULONG_PTR cookie = 0; +#endif + /* We use LoadLibraryEx so Windows looks for dependent DLLs in directory of pathname first. However, Windows95 can sometimes not work correctly unless the absolute path is used. If GetFullPathName() fails, the LoadLibrary @@ -190,12 +193,16 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, sizeof(pathbuf), pathbuf, &dummy)) { +#if HAVE_SXS ULONG_PTR cookie = _Py_ActivateActCtx(); +#endif /* XXX This call doesn't exist in Windows CE */ hDLL = LoadLibraryEx(pathname, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - _Py_DeactivateActCtx(cookie); - } +#if HAVE_SXS + _Py_DeactivateActCtx(cookie); +#endif + } /* restore old error mode settings */ SetErrorMode(old_mode); From fe0377e02e004b2d212af6f540e0b15a019e729d Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Fri, 9 Aug 2024 14:46:49 -0500 Subject: [PATCH 06/11] Update Windows to support VC 14.0 See https://github.com/ActiveState/cpython/commit/65e4cb10d9d9964f30bc72561bf0e86833328a3b --- Lib/ctypes/util.py | 6 +++++- Lib/distutils/command/build_ext.py | 2 +- Lib/distutils/msvc9compiler.py | 3 +++ Lib/distutils/msvccompiler.py | 3 +++ PC/bdist_wininst/install.c | 29 ++++++----------------------- PC/pyconfig.h | 7 +++++++ 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index ab10ec52ee8c35..6c43d821a6439e 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -19,6 +19,8 @@ def _get_build_version(): i = i + len(prefix) s, rest = sys.version[i:].split(" ", 1) majorVersion = int(s[:-2]) - 6 + if majorVersion >= 13: + majorVersion += 1 minorVersion = int(s[2:3]) / 10.0 # I don't think paths are affected by minor version in version 6 if majorVersion == 6: @@ -36,8 +38,10 @@ def find_msvcrt(): return None if version <= 6: clibname = 'msvcrt' - else: + elif version <= 13: clibname = 'msvcr%d' % (version * 10) + else: + clibname = 'appcrt%d' % (version * 10) # If python was built with in debug mode import imp diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 65a60b5c72b893..b2ee260d7e5df3 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -196,7 +196,7 @@ def finalize_options(self): if MSVC_VERSION >= 9: # Use the .lib files for the correct architecture if self.plat_name == 'win32': - suffix = '' + suffix = 'win32' else: # win-amd64 or win-ia64 suffix = self.plat_name[4:] diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py index 6cb5ef7a2449d5..f4194f596d0f5d 100644 --- a/Lib/distutils/msvc9compiler.py +++ b/Lib/distutils/msvc9compiler.py @@ -242,6 +242,9 @@ def get_build_version(): i = i + len(prefix) s, rest = sys.version[i:].split(" ", 1) majorVersion = int(s[:-2]) - 6 + if majorVersion >= 13: + # v13 was skipped and should be v14 + majorVersion += 1 minorVersion = int(s[2:3]) / 10.0 # I don't think paths are affected by minor version in version 6 if majorVersion == 6: diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index 0e69fd368cac78..77025c66e22781 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -164,6 +164,9 @@ def get_build_version(): i = i + len(prefix) s, rest = sys.version[i:].split(" ", 1) majorVersion = int(s[:-2]) - 6 + if majorVersion >= 13: + # v13 was skipped and should be v14 + majorVersion += 1 minorVersion = int(s[2:3]) / 10.0 # I don't think paths are affected by minor version in version 6 if majorVersion == 6: diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c index e3b52a80554bd7..a7d1c2c29c5083 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -1185,7 +1185,7 @@ static void CenterWindow(HWND hwnd) #include -BOOL CALLBACK +INT_PTR CALLBACK IntroDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LPNMHDR lpnm; @@ -1534,7 +1534,7 @@ SCHEME *GetScheme(int major, int minor) return old_scheme; } -BOOL CALLBACK +INT_PTR CALLBACK SelectPythonDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LPNMHDR lpnm; @@ -1836,7 +1836,7 @@ static void CloseLogfile(void) fclose(logfile); } -BOOL CALLBACK +INT_PTR CALLBACK InstallFilesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LPNMHDR lpnm; @@ -1991,7 +1991,7 @@ InstallFilesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } -BOOL CALLBACK +INT_PTR CALLBACK FinishedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LPNMHDR lpnm; @@ -2167,23 +2167,6 @@ BOOL NeedAutoUAC() return TRUE; } -// Returns TRUE if the platform supports UAC. -BOOL PlatformSupportsUAC() -{ - // Note that win2k does seem to support ShellExecute with 'runas', - // but does *not* support IsUserAnAdmin - so we just pretend things - // only work on XP and later. - BOOL bIsWindowsXPorLater; - OSVERSIONINFO winverinfo; - winverinfo.dwOSVersionInfoSize = sizeof(winverinfo); - if (!GetVersionEx(&winverinfo)) - return FALSE; // something bad has gone wrong - bIsWindowsXPorLater = - ( (winverinfo.dwMajorVersion > 5) || - ( (winverinfo.dwMajorVersion == 5) && (winverinfo.dwMinorVersion >= 1) )); - return bIsWindowsXPorLater; -} - // Spawn ourself as an elevated application. On failure, a message is // displayed to the user - but this app will always terminate, even // on error. @@ -2239,7 +2222,7 @@ int DoInstall(void) // See if we need to do the Vista UAC magic. if (strcmp(user_access_control, "force")==0) { - if (PlatformSupportsUAC() && !MyIsUserAnAdmin()) { + if (!MyIsUserAnAdmin()) { SpawnUAC(); return 0; } @@ -2247,7 +2230,7 @@ int DoInstall(void) } else if (strcmp(user_access_control, "auto")==0) { // Check if it looks like we need UAC control, based // on how Python itself was installed. - if (PlatformSupportsUAC() && !MyIsUserAnAdmin() && NeedAutoUAC()) { + if (!MyIsUserAnAdmin() && NeedAutoUAC()) { SpawnUAC(); return 0; } diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 0cbd236d945bb8..465f77a3757595 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -226,6 +226,13 @@ typedef int pid_t; #define Py_IS_FINITE(X) _finite(X) #define copysign _copysign +/* VS 2015 defines these names with a leading underscore */ +#if _MSC_VER >= 1900 +#define timezone _timezone +#define daylight _daylight +#define tzname _tzname +#endif + /* Side by Side assemblies supported in VS 2005 and VS 2008 but not 2010*/ #if _MSC_VER >= 1400 && _MSC_VER < 1600 #define HAVE_SXS 1 From 56a92ecf9b8636a2577b8e12a8efc7ed291b6e3c Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Fri, 9 Aug 2024 15:29:26 -0500 Subject: [PATCH 07/11] Remove explicit BaseAddress This should be handled dynmically by the new compiler. --- PCbuild/_bsddb.vcxproj | 1 - PCbuild/_ctypes.vcxproj | 1 - PCbuild/_elementtree.vcxproj | 3 --- PCbuild/_msi.vcxproj | 1 - PCbuild/_multiprocessing.vcxproj | 1 - PCbuild/_socket.vcxproj | 1 - PCbuild/_sqlite3.vcxproj | 3 --- PCbuild/_testcapi.vcxproj | 5 ----- PCbuild/bz2.vcxproj | 3 --- PCbuild/python.vcxproj | 1 - PCbuild/pythoncore.vcxproj | 1 - PCbuild/pythonw.vcxproj | 1 - PCbuild/select.vcxproj | 1 - PCbuild/unicodedata.vcxproj | 5 ----- 14 files changed, 28 deletions(-) diff --git a/PCbuild/_bsddb.vcxproj b/PCbuild/_bsddb.vcxproj index 8ce64b500f1301..92b07b5825e393 100644 --- a/PCbuild/_bsddb.vcxproj +++ b/PCbuild/_bsddb.vcxproj @@ -67,7 +67,6 @@ ws2_32.lib;%(AdditionalDependencies) - 0x1e180000 diff --git a/PCbuild/_ctypes.vcxproj b/PCbuild/_ctypes.vcxproj index 5bcf4325d9da39..1e9e2f51323a4e 100644 --- a/PCbuild/_ctypes.vcxproj +++ b/PCbuild/_ctypes.vcxproj @@ -64,7 +64,6 @@ ..\Modules\_ctypes\libffi_msvc;%(AdditionalIncludeDirectories) - 0x1D1A0000 /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions) diff --git a/PCbuild/_elementtree.vcxproj b/PCbuild/_elementtree.vcxproj index 511e26bb60dbd8..6d1f2dd94afb8a 100644 --- a/PCbuild/_elementtree.vcxproj +++ b/PCbuild/_elementtree.vcxproj @@ -64,9 +64,6 @@ ..\Modules\expat;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) - - 0x1D100000 - diff --git a/PCbuild/_msi.vcxproj b/PCbuild/_msi.vcxproj index 6c5fa8cf658174..ebf02f926211ab 100644 --- a/PCbuild/_msi.vcxproj +++ b/PCbuild/_msi.vcxproj @@ -62,7 +62,6 @@ cabinet.lib;msi.lib;rpcrt4.lib;%(AdditionalDependencies) - 0x1D160000 diff --git a/PCbuild/_multiprocessing.vcxproj b/PCbuild/_multiprocessing.vcxproj index 3a71c17f2200ab..fc666b8be89433 100644 --- a/PCbuild/_multiprocessing.vcxproj +++ b/PCbuild/_multiprocessing.vcxproj @@ -62,7 +62,6 @@ ws2_32.lib;%(AdditionalDependencies) - 0x1e1D0000 diff --git a/PCbuild/_socket.vcxproj b/PCbuild/_socket.vcxproj index 453d3f7f433d55..2debf21ff1e94c 100644 --- a/PCbuild/_socket.vcxproj +++ b/PCbuild/_socket.vcxproj @@ -62,7 +62,6 @@ ws2_32.lib;%(AdditionalDependencies) - 0x1e1D0000 diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj index 0995a2c8a2de20..cb5b204e9ee8a1 100644 --- a/PCbuild/_sqlite3.vcxproj +++ b/PCbuild/_sqlite3.vcxproj @@ -64,9 +64,6 @@ $(sqlite3Dir)include;%(AdditionalIncludeDirectories) MODULE_NAME="sqlite3";%(PreprocessorDefinitions) - - 0x1e180000 - diff --git a/PCbuild/_testcapi.vcxproj b/PCbuild/_testcapi.vcxproj index 77df0cb34df92e..4c8e7ada4e598a 100644 --- a/PCbuild/_testcapi.vcxproj +++ b/PCbuild/_testcapi.vcxproj @@ -60,11 +60,6 @@ <_ProjectFileVersion>10.0.30319.1 - - - 0x1e1F0000 - - diff --git a/PCbuild/bz2.vcxproj b/PCbuild/bz2.vcxproj index 3cab2886c1d083..c4235db3517e38 100644 --- a/PCbuild/bz2.vcxproj +++ b/PCbuild/bz2.vcxproj @@ -77,9 +77,6 @@ $(bz2Dir);%(AdditionalIncludeDirectories) WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - - 0x1D170000 - diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj index c1ab6e9ca9e143..a73a1a9229f391 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -66,7 +66,6 @@ Console 2000000 - 0x1d000000 diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index f8f59a7c37239f..1ea3cb60a06c39 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -78,7 +78,6 @@ $(OutDir);%(AdditionalLibraryDirectories);$(zlibLibDir) $(OutDir);%(AdditionalLibraryDirectories);$(zlibLibDir) $(OutDir);%(AdditionalLibraryDirectories);$(zlibLibDir) - 0x1e000000 diff --git a/PCbuild/pythonw.vcxproj b/PCbuild/pythonw.vcxproj index 8c5335c9563875..079594e9b15d5e 100644 --- a/PCbuild/pythonw.vcxproj +++ b/PCbuild/pythonw.vcxproj @@ -65,7 +65,6 @@ 2000000 - 0x1d000000 diff --git a/PCbuild/select.vcxproj b/PCbuild/select.vcxproj index 1cae1efd56cde8..ee526164d37ff2 100644 --- a/PCbuild/select.vcxproj +++ b/PCbuild/select.vcxproj @@ -61,7 +61,6 @@ ws2_32.lib;%(AdditionalDependencies) - 0x1D110000 diff --git a/PCbuild/unicodedata.vcxproj b/PCbuild/unicodedata.vcxproj index 92df09b010dbb0..426f81416e9806 100644 --- a/PCbuild/unicodedata.vcxproj +++ b/PCbuild/unicodedata.vcxproj @@ -59,11 +59,6 @@ <_ProjectFileVersion>10.0.30319.1 - - - 0x1D120000 - - From 6b9ffc67d18851729b162bf25fd81864cb85b065 Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Fri, 9 Aug 2024 15:38:35 -0500 Subject: [PATCH 08/11] Revert dl_nt.c --- PC/dl_nt.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/PC/dl_nt.c b/PC/dl_nt.c index 6923b6e173b438..3e58bacb55ff2c 100644 --- a/PC/dl_nt.c +++ b/PC/dl_nt.c @@ -18,8 +18,7 @@ char dllVersionBuffer[16] = ""; // a private buffer HMODULE PyWin_DLLhModule = NULL; const char *PyWin_DLLVersionString = dllVersionBuffer; -#if HAVE_SXS -// Windows "Activation Context" work. +// Windows "Activation Context" work: // Our .pyd extension modules are generally built without a manifest (ie, // those included with Python and those built with a default distutils. // This requires we perform some "activation context" magic when loading our @@ -30,8 +29,6 @@ const char *PyWin_DLLVersionString = dllVersionBuffer; // As an added complication, this magic only works on XP or later - we simply // use the existence (or not) of the relevant function pointers from kernel32. // See bug 4566 (http://python.org/sf/4566) for more details. -// In Visual Studio 2010, side by side assemblies are no longer used by -// default. typedef BOOL (WINAPI * PFN_GETCURRENTACTCTX)(HANDLE *); typedef BOOL (WINAPI * PFN_ACTIVATEACTCTX)(HANDLE, ULONG_PTR *); @@ -78,7 +75,6 @@ void _Py_DeactivateActCtx(ULONG_PTR cookie) if (!(*pfnDeactivateActCtx)(0, cookie)) OutputDebugString("Python failed to de-activate the activation context\n"); } -#endif /* HAVE_SXS */ BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, @@ -91,8 +87,7 @@ BOOL WINAPI DllMain (HANDLE hInst, // 1000 is a magic number I picked out of the air. Could do with a #define, I spose... LoadString(hInst, 1000, dllVersionBuffer, sizeof(dllVersionBuffer)); -#if HAVE_SXS - // and capture our activation context for use when loading extensions. + // and capture our activation context for use when loading extensions. _LoadActCtxPointers(); if (pfnGetCurrentActCtx && pfnAddRefActCtx) if ((*pfnGetCurrentActCtx)(&PyWin_DLLhActivationContext)) { @@ -101,17 +96,14 @@ BOOL WINAPI DllMain (HANDLE hInst, else { OutputDebugString("Python failed to load the default " "activation context\n"); -#endif - return FALSE; + return FALSE; } break; case DLL_PROCESS_DETACH: -#if HAVE_SXS - if (pfnReleaseActCtx) + if (pfnReleaseActCtx) (*pfnReleaseActCtx)(PyWin_DLLhActivationContext); -#endif - break; + break; } return TRUE; } From 3496eaa23995d051f93d1b6de9052743f24ad3ab Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Fri, 9 Aug 2024 17:53:50 -0500 Subject: [PATCH 09/11] Skip timeb on Windows --- Modules/timemodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index bf58e80ff0eab3..40dd6b79925741 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -28,8 +28,8 @@ #endif #ifdef HAVE_FTIME -#include #if !defined(MS_WINDOWS) && !defined(PYOS_OS2) +#include extern int ftime(struct timeb *); #endif /* MS_WINDOWS */ #endif /* HAVE_FTIME */ From 3976860a4072287ae97f78e6b2b209e99e52b10a Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Fri, 9 Aug 2024 18:16:31 -0500 Subject: [PATCH 10/11] Revert timemodule --- Modules/timemodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 40dd6b79925741..bf58e80ff0eab3 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -28,8 +28,8 @@ #endif #ifdef HAVE_FTIME -#if !defined(MS_WINDOWS) && !defined(PYOS_OS2) #include +#if !defined(MS_WINDOWS) && !defined(PYOS_OS2) extern int ftime(struct timeb *); #endif /* MS_WINDOWS */ #endif /* HAVE_FTIME */ From 7bb1686ad70f963e9ebcf61c0b0163e09dbf340b Mon Sep 17 00:00:00 2001 From: icanhasmath Date: Fri, 9 Aug 2024 18:37:56 -0500 Subject: [PATCH 11/11] Revert PC/pyconfig.h --- PC/pyconfig.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 465f77a3757595..5fa6398793178a 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -226,26 +226,14 @@ typedef int pid_t; #define Py_IS_FINITE(X) _finite(X) #define copysign _copysign -/* VS 2015 defines these names with a leading underscore */ -#if _MSC_VER >= 1900 -#define timezone _timezone -#define daylight _daylight -#define tzname _tzname -#endif - -/* Side by Side assemblies supported in VS 2005 and VS 2008 but not 2010*/ -#if _MSC_VER >= 1400 && _MSC_VER < 1600 -#define HAVE_SXS 1 -#endif +#endif /* _MSC_VER */ /* define some ANSI types that are not defined in earlier Win headers */ -#if _MSC_VER >= 1200 +#if defined(_MSC_VER) && _MSC_VER >= 1200 /* This file only exists in VC 6.0 or higher */ #include #endif -#endif /* _MSC_VER */ - /* ------------------------------------------------------------------------*/ /* The Borland compiler defines __BORLANDC__ */ /* XXX These defines are likely incomplete, but should be easy to fix. */