[python3] Update to 3.9.5 (#17773)

* [python3] update to 3.9.5

* [vcpkg] update baseline

* [scripts] update to py 3.9.5
This commit is contained in:
Christian Rendina 2021-05-27 00:09:28 +02:00 committed by GitHub
parent 6fc4e607f1
commit 9d7244f2f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 25 deletions

View File

@ -5,15 +5,72 @@ Subject: [PATCH 7/7] restore support for windows 7
this backports the windows 7 compatible fix for bpo-39401 from gh-18234,
originally authored by Steve Dower, and removes explicit dependencies on
pathcch.
---
PC/getpathp.c | 55 +++++++++++++++++++++++++++++++++++---
PC/pyconfig.h | 4 +--
PCbuild/pythoncore.vcxproj | 2 +-
3 files changed, 54 insertions(+), 7 deletions(-)
pathcch.
The same mechanism is applied to fix posixmodule.c
---
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index c984e2e..6c9787a 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -18,7 +18,7 @@
FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */
# include <windows.h>
-# include <pathcch.h>
+# include <Shlwapi.h>
#endif
#include "pycore_ceval.h" // _PyEval_ReInitThreads()
@@ -4371,6 +4371,10 @@ os._path_splitroot
Removes everything after the root on Win32.
[clinic start generated code]*/
+static int _PathCchSkipRoot_Initialized = 0;
+typedef HRESULT (__stdcall *PPathCchSkipRoot) (PCWSTR pszPath, PCWSTR *ppszRootEnd);
+static PPathCchSkipRoot _PathCchSkipRoot;
+
static PyObject *
os__path_splitroot_impl(PyObject *module, path_t *path)
/*[clinic end generated code: output=ab7f1a88b654581c input=dc93b1d3984cffb6]*/
@@ -4380,6 +4384,19 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
PyObject *result = NULL;
HRESULT ret;
+ if (_PathCchSkipRoot_Initialized == 0) {
+ HMODULE pathapi = LoadLibraryExW(L"api-ms-win-core-path-l1-1-0.dll", NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
+
+ if (pathapi) {
+ _PathCchSkipRoot = (PPathCchSkipRoot)GetProcAddress(pathapi, "PathCchSkipRoot");
+ } else {
+ _PathCchSkipRoot = NULL;
+ }
+
+ _PathCchSkipRoot_Initialized = 1;
+ }
+
buffer = (wchar_t*)PyMem_Malloc(sizeof(wchar_t) * (wcslen(path->wide) + 1));
if (!buffer) {
return NULL;
@@ -4390,7 +4407,14 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
}
Py_BEGIN_ALLOW_THREADS
- ret = PathCchSkipRoot(buffer, &end);
+ if (_PathCchSkipRoot) {
+ ret = _PathCchSkipRoot(buffer, &end);
+ } else {
+ end = PathSkipRootW(buffer);
+ if (!end) {
+ ret = E_FAIL;
+ }
+ }
Py_END_ALLOW_THREADS
if (FAILED(ret)) {
result = Py_BuildValue("sO", "", path->object);
diff --git a/PC/getpathp.c b/PC/getpathp.c
index 53da3a6d05..3d58bbfe70 100644
index 53da3a6..3d58bbf 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -250,14 +250,43 @@ ismodule(wchar_t *filename, int update_filename)
@ -92,7 +149,7 @@ index 53da3a6d05..3d58bbfe70 100644
return _PyStatus_OK();
}
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
index 34269f0b75..812f6d9353 100644
index d7d3cf0..6e9c090 100644
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -136,8 +136,8 @@ WIN32 is still required for the locale module.
@ -107,7 +164,7 @@ index 34269f0b75..812f6d9353 100644
/* We only set these values when building Python - we don't want to force
these values on extensions, as that will affect the prototypes and
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index d8e8d2d086..df2892b0de 100644
index 2625d02..20e3d6e 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -106,7 +106,7 @@
@ -119,6 +176,3 @@ index d8e8d2d086..df2892b0de 100644
</Link>
</ItemDefinitionGroup>
<ItemGroup>
--
2.28.0.windows.1

View File

@ -5,7 +5,7 @@ endif()
set(PYTHON_VERSION_MAJOR 3)
set(PYTHON_VERSION_MINOR 9)
set(PYTHON_VERSION_PATCH 2)
set(PYTHON_VERSION_PATCH 5)
set(PYTHON_VERSION ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH})
set(PATCHES
@ -32,7 +32,7 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO python/cpython
REF v${PYTHON_VERSION}
SHA512 f13c7e50d2c7c00e67b801b0bbb6ab6a8b6bd16c706b3bdd9d2186de3830f0043d0b95d7993d65a169adc9097738906c07727f0df49cd2fb2916bdf0456896b6
SHA512 6bef5174f133e7eb48ad54d14b07f77500ac2cdcfb397cac9f19ecaaf5334fbcc999f755719883c99c0d173b7b816a2def56537666c20e7b11cb783572fc6e00
HEAD_REF master
PATCHES ${PATCHES}
)

View File

@ -1,7 +1,6 @@
{
"name": "python3",
"version-string": "3.9.2",
"port-version": 2,
"version-string": "3.9.5",
"description": "The Python programming language",
"homepage": "https://github.com/python/cpython",
"supports": "!(arm | uwp)",

View File

@ -148,17 +148,17 @@ function(vcpkg_find_acquire_program VAR)
elseif(VAR MATCHES "PYTHON3")
if(CMAKE_HOST_WIN32)
set(PROGNAME python)
set(PYTHON_VERSION 3.9.2)
set(PYTHON_VERSION 3.9.5)
if (VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
set(SUBDIR "python-${PYTHON_VERSION}-x86")
set(URL "https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-embed-win32.zip")
set(ARCHIVE "python-${PYTHON_VERSION}-embed-win32.zip")
set(HASH d792c6179887120ec3e945764b95ae8187032e1779f327feb90ded40ebd39cb78d000056df947f28c9e4257b60dd95ee43a3f77f47a1d8878cbe37ebc20f87a3)
set(HASH f0ff0760684f4d91bfe1270438e5dda691ae38a7558500d32b9a763ac9498d3ccac6e843cee5220c5e3dc841863ae3e1af256fa25354f2665cc34dc35fe4c2c7)
else()
set(SUBDIR "python-${PYTHON_VERSION}-x64")
set(URL "https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-embed-amd64.zip")
set(ARCHIVE "python-${PYTHON_VERSION}-embed-amd64.zip")
set(HASH 30f36938d264d160136eb7062846924b980b4f8f4373dab4fbc054c764041149f56760370de571be10410363563c5688a3f1f9ac19be5bb40ae914ddbdcb3c62)
set(HASH 92ba1b50c05c6978af3dde395c66319b181bc8d6cc5921d8f63cac333d574bc7e71ad85331356b79181d4a312a6133c246eaa9da242855e1e75a316487120897)
endif()
set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR})
set(POST_INSTALL_COMMAND ${CMAKE_COMMAND} -E rm python39._pth)

View File

@ -1,11 +1,11 @@
<?xml version="1.0"?>
<tools version="2">
<tool name="python3" os="windows">
<version>3.9.2</version>
<version>3.9.5</version>
<exeRelativePath>python.exe</exeRelativePath>
<url>https://www.python.org/ftp/python/3.9.2/python-3.9.2-embed-win32.zip</url>
<sha512>d792c6179887120ec3e945764b95ae8187032e1779f327feb90ded40ebd39cb78d000056df947f28c9e4257b60dd95ee43a3f77f47a1d8878cbe37ebc20f87a3</sha512>
<archiveName>python-3.9.2-embed-win32.zip</archiveName>
<url>https://www.python.org/ftp/python/3.9.5/python-3.9.5-embed-win32.zip</url>
<sha512>f0ff0760684f4d91bfe1270438e5dda691ae38a7558500d32b9a763ac9498d3ccac6e843cee5220c5e3dc841863ae3e1af256fa25354f2665cc34dc35fe4c2c7</sha512>
<archiveName>python-3.9.5-embed-win32.zip</archiveName>
</tool>
<tool name="cmake" os="windows">
<version>3.20.2</version>

View File

@ -5005,8 +5005,8 @@
"port-version": 0
},
"python3": {
"baseline": "3.9.2",
"port-version": 2
"baseline": "3.9.5",
"port-version": 0
},
"qca": {
"baseline": "2.3.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "16ae1dd8eb0498d1357af3155c565035ba9a3f39",
"version-string": "3.9.5",
"port-version": 0
},
{
"git-tree": "ebb4ed9ed737c672ca5462a4019a704b6461e91d",
"version-string": "3.9.2",