From fd5a12de8e4b19dc2c3d38252c88e1afa85900f7 Mon Sep 17 00:00:00 2001 From: mattip Date: Sat, 23 May 2020 23:50:48 +0300 Subject: [PATCH 01/19] Make py_version_nodot 3_10 not 310 --- Lib/sysconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index bf04ac541e6b02..ad622e3b6958aa 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -86,7 +86,7 @@ _PY_VERSION = sys.version.split()[0] _PY_VERSION_SHORT = '%d.%d' % sys.version_info[:2] -_PY_VERSION_SHORT_NO_DOT = '%d%d' % sys.version_info[:2] +_PY_VERSION_SHORT_NO_DOT = '%d_%d' % sys.version_info[:2] _PREFIX = os.path.normpath(sys.prefix) _BASE_PREFIX = os.path.normpath(sys.base_prefix) _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) From 76a596c6f657d55513f4d5369090d225a58d9c1d Mon Sep 17 00:00:00 2001 From: mattip Date: Sun, 24 May 2020 01:37:18 +0300 Subject: [PATCH 02/19] fix another place --- Lib/distutils/command/install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index aaa300efa96e6e..0ab66d99e48200 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -292,7 +292,7 @@ def finalize_options(self): 'dist_fullname': self.distribution.get_fullname(), 'py_version': py_version, 'py_version_short': '%d.%d' % sys.version_info[:2], - 'py_version_nodot': '%d%d' % sys.version_info[:2], + 'py_version_nodot': '%d_%d' % sys.version_info[:2], 'sys_prefix': prefix, 'prefix': prefix, 'sys_exec_prefix': exec_prefix, From 5eb6a84e507fd08c82e071612e911469b8e7cb4d Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 25 May 2020 12:38:51 +0300 Subject: [PATCH 03/19] fix more places that do not use py_version_nodot --- Lib/site.py | 2 +- configure | 4 ++-- configure.ac | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/site.py b/Lib/site.py index e981a142088fdf..2adebf1514f612 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -267,7 +267,7 @@ def _get_path(userbase): version = sys.version_info if os.name == 'nt': - return f'{userbase}\\Python{version[0]}{version[1]}\\site-packages' + return f'{userbase}\\Python{version[0]}_{version[1]}\\site-packages' if sys.platform == 'darwin' and sys._framework: return f'{userbase}/lib/python/site-packages' diff --git a/configure b/configure index 1124412dce4753..3b7036cb32f684 100755 --- a/configure +++ b/configure @@ -15295,7 +15295,7 @@ $as_echo_n "checking ABIFLAGS... " >&6; } $as_echo "$ABIFLAGS" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5 $as_echo_n "checking SOABI... " >&6; } -SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} +SOABI='cpython-'`echo $VERSION | tr "." "_"`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5 $as_echo "$SOABI" >&6; } @@ -15303,7 +15303,7 @@ $as_echo "$SOABI" >&6; } if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then # Similar to SOABI but remove "d" flag from ABIFLAGS - ALT_SOABI='cpython-'`echo $VERSION | tr -d .``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} + ALT_SOABI='cpython-'`echo $VERSION | tr -d "." "_"``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} cat >>confdefs.h <<_ACEOF #define ALT_SOABI "${ALT_SOABI}" diff --git a/configure.ac b/configure.ac index 84d1f00983f899..9fdc2f69ee82b9 100644 --- a/configure.ac +++ b/configure.ac @@ -4737,14 +4737,14 @@ AC_SUBST(SOABI) AC_MSG_CHECKING(ABIFLAGS) AC_MSG_RESULT($ABIFLAGS) AC_MSG_CHECKING(SOABI) -SOABI='cpython-'`echo $VERSION | tr -d .`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} +SOABI='cpython-'`echo $VERSION | tr -d "." "_"`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} AC_MSG_RESULT($SOABI) # Release and debug (Py_DEBUG) ABI are compatible, but not Py_TRACE_REFS ABI if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then # Similar to SOABI but remove "d" flag from ABIFLAGS AC_SUBST(ALT_SOABI) - ALT_SOABI='cpython-'`echo $VERSION | tr -d .``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} + ALT_SOABI='cpython-'`echo $VERSION | tr -d "." "_"``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} AC_DEFINE_UNQUOTED(ALT_SOABI, "${ALT_SOABI}", [Alternative SOABI used in debug build to load C extensions built in release mode]) fi From 9759ea9a75f22347e69202d0842867eea0634d5d Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Mon, 25 May 2020 09:46:32 +0000 Subject: [PATCH 04/19] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Misc/NEWS.d/next/Build/2020-05-25-09-46-32.bpo-40747.ef15ix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2020-05-25-09-46-32.bpo-40747.ef15ix.rst diff --git a/Misc/NEWS.d/next/Build/2020-05-25-09-46-32.bpo-40747.ef15ix.rst b/Misc/NEWS.d/next/Build/2020-05-25-09-46-32.bpo-40747.ef15ix.rst new file mode 100644 index 00000000000000..3d8e0b058de25c --- /dev/null +++ b/Misc/NEWS.d/next/Build/2020-05-25-09-46-32.bpo-40747.ef15ix.rst @@ -0,0 +1 @@ +The PEP 425 python tag, taken from ``py_version_nodot``, adds a ``_`` so ``cp310`` is now ``cp3_10``. \ No newline at end of file From b9fe6c246d770feba0ec087ac0f819303a2d96e0 Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 25 May 2020 12:54:37 +0300 Subject: [PATCH 05/19] test SOABI and py_version_nodot agree on the python version --- Lib/test/test_sysconfig.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 44e44bf5ea995f..c3bad2cbb47626 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -386,6 +386,12 @@ def test_osx_ext_suffix(self): suffix = sysconfig.get_config_var('EXT_SUFFIX') self.assertTrue(suffix.endswith('-darwin.so'), suffix) + def test_SOABI_consistency(self): + SOABI = sysconfig.get_config_var('SOABI') + pynodot = sysconfig.get_config_var('py_version_nodot') + if SOABI is not None: + self.assertTrue(SOABI.split('-')[1] == pynodot) + class MakefileTests(unittest.TestCase): @unittest.skipIf(sys.platform.startswith('win'), From 7149e08db2e84fde0cf80a20f57ec89eb597ba82 Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 25 May 2020 13:28:53 +0300 Subject: [PATCH 06/19] change test --- Lib/test/test_sysconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index c3bad2cbb47626..cd53173ab053ee 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -390,7 +390,7 @@ def test_SOABI_consistency(self): SOABI = sysconfig.get_config_var('SOABI') pynodot = sysconfig.get_config_var('py_version_nodot') if SOABI is not None: - self.assertTrue(SOABI.split('-')[1] == pynodot) + self.assertEqual(SOABI.split('-')[1], pynodot) class MakefileTests(unittest.TestCase): From 4f9b8693b7b81e45297f29ee319f6244299a4bc6 Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 25 May 2020 14:36:37 +0300 Subject: [PATCH 07/19] change test, SOABI has a 'd' after the python version --- Lib/test/test_sysconfig.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index cd53173ab053ee..8e08cdd803c85b 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -387,10 +387,11 @@ def test_osx_ext_suffix(self): self.assertTrue(suffix.endswith('-darwin.so'), suffix) def test_SOABI_consistency(self): - SOABI = sysconfig.get_config_var('SOABI') + soabi = sysconfig.get_config_var('SOABI') pynodot = sysconfig.get_config_var('py_version_nodot') - if SOABI is not None: - self.assertEqual(SOABI.split('-')[1], pynodot) + if soabi is not None: + soabi_pyver = soabi.split('-')[1] + self.assertTrue(soabi_pyver.startswith(pynodot)) class MakefileTests(unittest.TestCase): From 48ec1e91283829c9b062f172516fe04dcd4cc5e4 Mon Sep 17 00:00:00 2001 From: mattip Date: Thu, 28 May 2020 08:39:18 +0300 Subject: [PATCH 08/19] remove '-d' from tr --- configure | 4 ++-- configure.ac | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 3b7036cb32f684..fcd30aef73ad83 100755 --- a/configure +++ b/configure @@ -15295,7 +15295,7 @@ $as_echo_n "checking ABIFLAGS... " >&6; } $as_echo "$ABIFLAGS" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5 $as_echo_n "checking SOABI... " >&6; } -SOABI='cpython-'`echo $VERSION | tr "." "_"`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} +SOABI='cpython-'`echo $VERSION | tr . _`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOABI" >&5 $as_echo "$SOABI" >&6; } @@ -15303,7 +15303,7 @@ $as_echo "$SOABI" >&6; } if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then # Similar to SOABI but remove "d" flag from ABIFLAGS - ALT_SOABI='cpython-'`echo $VERSION | tr -d "." "_"``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} + ALT_SOABI='cpython-'`echo $VERSION | tr . _``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} cat >>confdefs.h <<_ACEOF #define ALT_SOABI "${ALT_SOABI}" diff --git a/configure.ac b/configure.ac index 9fdc2f69ee82b9..8704a5c448849b 100644 --- a/configure.ac +++ b/configure.ac @@ -4737,16 +4737,17 @@ AC_SUBST(SOABI) AC_MSG_CHECKING(ABIFLAGS) AC_MSG_RESULT($ABIFLAGS) AC_MSG_CHECKING(SOABI) -SOABI='cpython-'`echo $VERSION | tr -d "." "_"`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} +SOABI='cpython-'`echo $VERSION | tr . _`${ABIFLAGS}${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} AC_MSG_RESULT($SOABI) # Release and debug (Py_DEBUG) ABI are compatible, but not Py_TRACE_REFS ABI if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then # Similar to SOABI but remove "d" flag from ABIFLAGS AC_SUBST(ALT_SOABI) - ALT_SOABI='cpython-'`echo $VERSION | tr -d "." "_"``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} + ALT_SOABI='cpython-'`echo $VERSION | tr . _``echo $ABIFLAGS | tr -d d`${PLATFORM_TRIPLET:+-$PLATFORM_TRIPLET} AC_DEFINE_UNQUOTED(ALT_SOABI, "${ALT_SOABI}", [Alternative SOABI used in debug build to load C extensions built in release mode]) + AC_MSG_RESULT($ALT_SOABI) fi AC_SUBST(EXT_SUFFIX) From 079e5e39785158c4ac2b3d46c9f79baa59118b72 Mon Sep 17 00:00:00 2001 From: mattip Date: Tue, 8 Sep 2020 23:48:09 +0300 Subject: [PATCH 09/19] fix merge from master --- Lib/site.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/site.py b/Lib/site.py index 4c095774729c5e..7b28ba93221fda 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -274,8 +274,7 @@ def _get_path(userbase): version = sys.version_info if os.name == 'nt': - ver_nodot = sys.winver.replace('.', '') - return f'{userbase}\\Python{ver_nodot}\\site-packages' + return f'{userbase}\\Python{version[0]}_{version[1]}\\site-packages' if sys.platform == 'darwin' and sys._framework: return f'{userbase}/lib/python/site-packages' From 5e3760bd784d619812d31d0232d046758c0e3606 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 9 Sep 2020 00:44:45 +0300 Subject: [PATCH 10/19] dig into windows dll names and install schemes --- Lib/sysconfig.py | 2 +- PC/bdist_wininst/install.c | 4 ++-- PC/pyconfig.h | 4 ++-- PCbuild/pcbuild.proj | 2 +- PCbuild/python.props | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index 8452f8fc9351e8..dc9b9a5c8269da 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -545,7 +545,7 @@ def get_config_vars(*args): # sys.abiflags may not be defined on all platforms. _CONFIG_VARS['abiflags'] = '' try: - _CONFIG_VARS['py_version_nodot_plat'] = sys.winver.replace('.', '') + _CONFIG_VARS['py_version_nodot_plat'] = sys.winver.replace('.', '_') except AttributeError: _CONFIG_VARS['py_version_nodot_plat'] = '' diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c index 5d77542582a0d4..271b74df0df901 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -1683,10 +1683,10 @@ SelectPythonDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) &py_major, &py_minor); if (result == 2) { #ifdef _DEBUG - wsprintf(pythondll, "python%d%d_d.dll", + wsprintf(pythondll, "python%d_%d_d.dll", py_major, py_minor); #else - wsprintf(pythondll, "python%d%d.dll", + wsprintf(pythondll, "python%d_%d.dll", py_major, py_minor); #endif } diff --git a/PC/pyconfig.h b/PC/pyconfig.h index b29f63c35bccb1..aa1464425b5993 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -269,11 +269,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ file in their Makefile (other compilers are generally taken care of by distutils.) */ # if defined(_DEBUG) -# pragma comment(lib,"python310_d.lib") +# pragma comment(lib,"python3_10_d.lib") # elif defined(Py_LIMITED_API) # pragma comment(lib,"python3.lib") # else -# pragma comment(lib,"python310.lib") +# pragma comment(lib,"python3_10.lib") # endif /* _DEBUG */ # endif /* _MSC_VER */ # endif /* Py_BUILD_CORE */ diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index 4d416c589e4c47..f819c326e1e15b 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -34,7 +34,7 @@ - + - python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt) + + python$(MajorVersionNumber)_$(MinorVersionNumber)$(PyDebugExt) python3$(PyDebugExt) - .cp$(MajorVersionNumber)$(MinorVersionNumber)-win32 - .cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm32 - .cp$(MajorVersionNumber)$(MinorVersionNumber)-win_arm64 - .cp$(MajorVersionNumber)$(MinorVersionNumber)-win_amd64 + .cp$(MajorVersionNumber)_$(MinorVersionNumber)-win32 + .cp$(MajorVersionNumber)_$(MinorVersionNumber)-win_arm32 + .cp$(MajorVersionNumber)_$(MinorVersionNumber)-win_arm64 + .cp$(MajorVersionNumber)_$(MinorVersionNumber)-win_amd64 $(MajorVersionNumber).$(MinorVersionNumber)$(PyArchExt)$(PyTestExt) From 411c15067037d4e444dbe19a89ad671fe38ee671 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 9 Sep 2020 01:11:18 +0300 Subject: [PATCH 11/19] fix test --- Lib/test/test_embed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 31dc39fd9e8efe..a7922182ba8bb0 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1172,9 +1172,9 @@ def tmpdir_with_python(self): tmpdir = os.path.realpath(tmpdir) if MS_WINDOWS: - # Copy pythonXY.dll (or pythonXY_d.dll) + # Copy pythonX_Y.dll (or pythonX_Y_d.dll) ver = sys.version_info - dll = f'python{ver.major}{ver.minor}' + dll = f'python{ver.major}_{ver.minor}' dll3 = f'python{ver.major}' if debug_build(sys.executable): dll += '_d' From d201030c1d319145e3ead700fb659401fde4d5f1 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 9 Sep 2020 08:25:40 +0300 Subject: [PATCH 12/19] fix merge from master --- Lib/site.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/site.py b/Lib/site.py index 7b28ba93221fda..87353c088113a7 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -274,7 +274,8 @@ def _get_path(userbase): version = sys.version_info if os.name == 'nt': - return f'{userbase}\\Python{version[0]}_{version[1]}\\site-packages' + ver_nodot = sys.winver.replace('.', '_') + return f'{userbase}\\Python{ver_nodot}\\site-packages' if sys.platform == 'darwin' and sys._framework: return f'{userbase}/lib/python/site-packages' From b549f0919b6c5c5bf33a56e864ee8b1a1aa0a450 Mon Sep 17 00:00:00 2001 From: mattip Date: Tue, 13 Oct 2020 09:35:05 +0300 Subject: [PATCH 13/19] changes from review --- Doc/extending/windows.rst | 18 ++++++++++++------ Doc/whatsnew/3.10.rst | 2 ++ PC/layout/support/constants.py | 8 ++++---- Tools/msi/bundle/bootstrap/pythonba.vcxproj | 4 ++-- Tools/msi/bundle/bundle.wxs | 2 +- Tools/msi/core/core_files.wxs | 8 ++++---- Tools/msi/dev/dev_files.wxs | 4 ++-- Tools/msi/doc/doc.wixproj | 4 ++-- Tools/msi/msi.props | 6 +++--- Tools/msi/tcltk/tcltk_reg.wxs | 6 +++--- Tools/msi/uploadrelease.proj | 2 +- 11 files changed, 36 insertions(+), 28 deletions(-) diff --git a/Doc/extending/windows.rst b/Doc/extending/windows.rst index c7b92c6ea24ca8..c04625bedfb514 100644 --- a/Doc/extending/windows.rst +++ b/Doc/extending/windows.rst @@ -23,9 +23,9 @@ C++. This chapter mentions a number of filenames that include an encoded Python version number. These filenames are represented with the version number shown - as ``XY``; in practice, ``'X'`` will be the major version number and ``'Y'`` + as ``X_Y``; in practice, ``'X'`` will be the major version number and ``'Y'`` will be the minor version number of the Python release you're working with. For - example, if you are using Python 2.2.1, ``XY`` will actually be ``22``. + example, if you are using Python 3.10.1, ``X_Y`` will actually be ``3_10``. .. _win-cookbook: @@ -109,17 +109,23 @@ Windows Python is built in Microsoft Visual C++; using other compilers may or may not work (though Borland seems to). The rest of this section is MSVC++ specific. -When creating DLLs in Windows, you must pass :file:`pythonXY.lib` to the linker. +When creating DLLs in Windows, the linker expects to see the import library +:file:`pythonX_Y.lib` in order to find all the C-API functions available in +:file:`pythonX_Y.dll` (or in the case of universal c-extensions, +:file:`pythonX.lib` and :file:`pythonX.dll` respectively. This is handled with +a pragma in :file:`pyconfig.h` so you do not need to add anything special in +your build. + To build two DLLs, spam and ni (which uses C functions found in spam), you could use these commands:: - cl /LD /I/python/include spam.c ../libs/pythonXY.lib - cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib + cl /LD /I/python/include spam.c + cl /LD /I/python/include ni.c spam.lib The first command created three files: :file:`spam.obj`, :file:`spam.dll` and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find the Python code -thanks to :file:`pythonXY.lib`. +thanks to the pragma and linking to the proper import lib. The second command created :file:`ni.dll` (and :file:`.obj` and :file:`.lib`), which knows how to find the necessary functions from spam, and also from the diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index f6f276a8bfa495..e0f4fb69d5a216 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -93,6 +93,8 @@ Other Language Changes :meth:`~object.__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.) +* The ``nodot`` version number has been changed to ``3_10`` for clarity + (:issue:`40747`) New Modules =========== diff --git a/PC/layout/support/constants.py b/PC/layout/support/constants.py index 6cf0fe1d34c4ac..1341d281d7e131 100644 --- a/PC/layout/support/constants.py +++ b/PC/layout/support/constants.py @@ -32,11 +32,11 @@ def _get_suffix(field4): VER_FIELD3 = VER_MICRO << 8 | VER_FIELD4 VER_DOT = "{}.{}".format(VER_MAJOR, VER_MINOR) -PYTHON_DLL_NAME = "python{}{}.dll".format(VER_MAJOR, VER_MINOR) +PYTHON_DLL_NAME = "python{}_{}.dll".format(VER_MAJOR, VER_MINOR) PYTHON_STABLE_DLL_NAME = "python{}.dll".format(VER_MAJOR) -PYTHON_ZIP_NAME = "python{}{}.zip".format(VER_MAJOR, VER_MINOR) -PYTHON_PTH_NAME = "python{}{}._pth".format(VER_MAJOR, VER_MINOR) +PYTHON_ZIP_NAME = "python{}_{}.zip".format(VER_MAJOR, VER_MINOR) +PYTHON_PTH_NAME = "python{}_{}._pth".format(VER_MAJOR, VER_MINOR) -PYTHON_CHM_NAME = "python{}{}{}{}.chm".format( +PYTHON_CHM_NAME = "python{}_{}{}{}.chm".format( VER_MAJOR, VER_MINOR, VER_MICRO, VER_SUFFIX ) diff --git a/Tools/msi/bundle/bootstrap/pythonba.vcxproj b/Tools/msi/bundle/bootstrap/pythonba.vcxproj index ef71fe7da08d32..1744e2e50e8b6d 100644 --- a/Tools/msi/bundle/bootstrap/pythonba.vcxproj +++ b/Tools/msi/bundle/bootstrap/pythonba.vcxproj @@ -35,7 +35,7 @@ DynamicLibrary Unicode $(PySourcePath)PCbuild\obj\ - $(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\msi_$(ProjectName)\ + $(Py_IntDir)\$(MajorVersionNumber)_$(MinorVersionNumber)$(ArchName)_$(Configuration)\msi_$(ProjectName)\ $(IntDir.Replace(`\\`, `\`)) $(IntDir) @@ -73,4 +73,4 @@ - \ No newline at end of file + diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs index ddd6870f625526..568a44e872e1f7 100644 --- a/Tools/msi/bundle/bundle.wxs +++ b/Tools/msi/bundle/bundle.wxs @@ -24,7 +24,7 @@ - + diff --git a/Tools/msi/core/core_files.wxs b/Tools/msi/core/core_files.wxs index 145e1471247aa1..106802b2fb5342 100644 --- a/Tools/msi/core/core_files.wxs +++ b/Tools/msi/core/core_files.wxs @@ -6,14 +6,14 @@ - + - + @@ -23,8 +23,8 @@ - - + + diff --git a/Tools/msi/dev/dev_files.wxs b/Tools/msi/dev/dev_files.wxs index 21f9c848cc6be5..ed49c416e27f60 100644 --- a/Tools/msi/dev/dev_files.wxs +++ b/Tools/msi/dev/dev_files.wxs @@ -14,7 +14,7 @@ - + @@ -25,7 +25,7 @@ - + diff --git a/Tools/msi/doc/doc.wixproj b/Tools/msi/doc/doc.wixproj index ea9929acd05ff7..97d8127b88d19a 100644 --- a/Tools/msi/doc/doc.wixproj +++ b/Tools/msi/doc/doc.wixproj @@ -10,7 +10,7 @@ - python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm + python$(MajorVersionNumber)_$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm false true @@ -27,4 +27,4 @@ - \ No newline at end of file + diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props index 3f14501446a15a..12120a6f8bda97 100644 --- a/Tools/msi/msi.props +++ b/Tools/msi/msi.props @@ -48,7 +48,7 @@ - $(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\msi_$(OutputName) + $(Py_IntDir)\$(MajorVersionNumber)_$(MinorVersionNumber)$(ArchName)_$(Configuration)\msi_$(OutputName) $(IntermediateOutputPath)_$(OutputSuffix) $(BuildPath) $(OutputPath)\ @@ -57,7 +57,7 @@ $(ExternalsDir)\windows-installer\redist-1\$(Platform) $([System.IO.Path]::GetFullPath($(CRTRedist))) $(tcltkDir)lib - python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm + python$(MajorVersionNumber)_$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm $(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value).0 @@ -184,4 +184,4 @@ $(DefineConstants);@(_UuidValue,';'); - \ No newline at end of file + diff --git a/Tools/msi/tcltk/tcltk_reg.wxs b/Tools/msi/tcltk/tcltk_reg.wxs index 2778bcc80669b6..85361b47cab007 100644 --- a/Tools/msi/tcltk/tcltk_reg.wxs +++ b/Tools/msi/tcltk/tcltk_reg.wxs @@ -16,7 +16,7 @@ VersionNT > 600 - + @@ -31,14 +31,14 @@ VersionNT = 600 - + VersionNT = 600 - + diff --git a/Tools/msi/uploadrelease.proj b/Tools/msi/uploadrelease.proj index e70ae1de22fa78..17cfe7f803c9a7 100644 --- a/Tools/msi/uploadrelease.proj +++ b/Tools/msi/uploadrelease.proj @@ -27,7 +27,7 @@ $(EXETarget) - + $(EXETarget) From ca4efd9b92f929448279635ed591756d75c1d5db Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 21 Oct 2020 15:48:52 +0100 Subject: [PATCH 14/19] Fixup documentation filename --- Doc/conf.py | 2 +- Doc/make.bat | 2 +- Tools/msi/doc/doc.wixproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py index 079d17717f381c..1390fb54629933 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -105,7 +105,7 @@ html_static_path = ['tools/static'] # Output file base name for HTML help builder. -htmlhelp_basename = 'python' + release.replace('.', '') +htmlhelp_basename = 'python' + release # Split the index html_split_index = True diff --git a/Doc/make.bat b/Doc/make.bat index 7fde0636427713..0611f6f33340c2 100644 --- a/Doc/make.bat +++ b/Doc/make.bat @@ -140,7 +140,7 @@ if "%1" EQU "htmlhelp" ( cmd /S /C "%SPHINXBUILD% %SPHINXOPTS% -b%1 -dbuild\doctrees . "%BUILDDIR%\%1" %2 %3 %4 %5 %6 %7 %8 %9" if "%1" EQU "htmlhelp" ( - "%HTMLHELP%" "%BUILDDIR%\htmlhelp\python%DISTVERSION:.=%.hhp" + "%HTMLHELP%" "%BUILDDIR%\htmlhelp\python%DISTVERSION%.hhp" rem hhc.exe seems to always exit with code 1, reset to 0 for less than 2 if not errorlevel 2 cmd /C exit /b 0 ) diff --git a/Tools/msi/doc/doc.wixproj b/Tools/msi/doc/doc.wixproj index 97d8127b88d19a..31421f62b42868 100644 --- a/Tools/msi/doc/doc.wixproj +++ b/Tools/msi/doc/doc.wixproj @@ -10,7 +10,7 @@ - python$(MajorVersionNumber)_$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm + python$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName).chm false true From db2d390d91002458814f0f1b46986ec8c225de1f Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 21 Oct 2020 17:20:56 +0100 Subject: [PATCH 15/19] Update file layout versions to include the dot or underscore as appropriate --- Doc/c-api/stable.rst | 4 +- Doc/faq/windows.rst | 4 +- Doc/using/windows.rst | 4 +- Doc/whatsnew/3.10.rst | 9 ++++ Include/pythonrun.h | 2 +- Modules/getpath.c | 2 +- PC/getpathp.c | 8 ++-- PC/pyconfig.h | 4 +- PC/readme.txt | 81 ----------------------------------- PC/testpy.py | 30 ------------- PCbuild/python.props | 2 +- PCbuild/readme.txt | 2 +- Programs/_freeze_importlib.c | 2 +- Tools/msi/README.txt | 2 +- Tools/msi/core/core_files.wxs | 8 ++-- Tools/msi/dev/dev_files.wxs | 4 +- 16 files changed, 33 insertions(+), 135 deletions(-) delete mode 100644 PC/readme.txt delete mode 100644 PC/testpy.py diff --git a/Doc/c-api/stable.rst b/Doc/c-api/stable.rst index 9c05cb3c82dfbe..79d66bb2fe75a9 100644 --- a/Doc/c-api/stable.rst +++ b/Doc/c-api/stable.rst @@ -17,8 +17,8 @@ addition of a new field, or changing the type of a field, might not break the API, but can break the ABI. As a consequence, extension modules need to be recompiled for every Python release (although an exception is possible on Unix when none of the affected interfaces are used). In addition, on Windows, -extension modules link with a specific pythonXY.dll and need to be recompiled to -link with a newer one. +extension modules link with a specific python3.X.dll and need to be recompiled +to link with a newer one. Since Python 3.2, a subset of the API has been declared to guarantee a stable ABI. Extension modules wishing to use this API (called "limited API") need to diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst index c8e9c5fb670301..9fc08213df9d03 100644 --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -222,7 +222,7 @@ Embedding the Python interpreter in a Windows app can be summarized as follows: PyRun_SimpleString("import myApp"); // Import the shadow class. 5. There are two problems with Python's C API which will become apparent if you - use a compiler other than MSVC, the compiler used to build pythonNN.dll. + use a compiler other than MSVC, the compiler used to build python3.X.dll. Problem 1: The so-called "Very High Level" functions that take FILE * arguments will not work in a multi-compiler environment because each @@ -239,7 +239,7 @@ Embedding the Python interpreter in a Windows app can be summarized as follows: return _resultobj; Alas, Py_None is a macro that expands to a reference to a complex data - structure called _Py_NoneStruct inside pythonNN.dll. Again, this code will + structure called _Py_NoneStruct inside python3.X.dll. Again, this code will fail in a mult-compiler environment. Replace such code by: .. code-block:: c diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 275495bc6d1292..3d28a844f402b2 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -409,7 +409,7 @@ directly accessed by end-users. When extracted, the embedded distribution is (almost) fully isolated from the user's system, including environment variables, system registry settings, and installed packages. The standard library is included as pre-compiled and -optimized ``.pyc`` files in a ZIP, and ``python3.dll``, ``python37.dll``, +optimized ``.pyc`` files in a ZIP, and ``python3.dll``, ``python3.10.dll``, ``python.exe`` and ``pythonw.exe`` are all provided. Tcl/tk (including all dependants, such as Idle), pip and the Python documentation are not included. @@ -1030,7 +1030,7 @@ following advice will prevent conflicts with other installations: environment variables, and also ignore :mod:`site` unless ``import site`` is listed. -* If you are loading :file:`python3.dll` or :file:`python37.dll` in your own +* If you are loading :file:`python3.dll` or :file:`python3.10.dll` in your own executable, explicitly call :c:func:`Py_SetPath` or (at least) :c:func:`Py_SetProgramName` before :c:func:`Py_Initialize`. diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 900cfd6fea89fb..9232820c6ffb96 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -297,6 +297,15 @@ Build Changes * :mod:`sqlite3` requires SQLite 3.7.3 or higher. (Contributed by Sergey Fedoseev and Erlend E. Aasland :issue:`40744`.) +* The main Python DLL on Windows is now named :file:`python3.10.dll` (previously + there was no dot between the two version numbers). + +* The default installation directory on Windows is now named ``Python3_10`` or + ``Python3_10-32`` (previously there was no underscore between the two version + numbers). + +* The default standard library ZIP file is now named ``python3.10.zip`` on all + platforms (previously there was no dot between the two version numbers). C API Changes diff --git a/Include/pythonrun.h b/Include/pythonrun.h index d43734b5a12ff0..c04db1bf0e7a90 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -95,7 +95,7 @@ PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); /* A function flavor is also exported by libpython. It is required when libpython is accessed directly rather than using header files which defines macros below. On Windows, for example, PyAPI_FUNC() uses dllexport to - export functions in pythonXX.dll. */ + export functions in pythonX.X.dll. */ PyAPI_FUNC(PyObject *) PyRun_String(const char *str, int s, PyObject *g, PyObject *l); PyAPI_FUNC(int) PyRun_AnyFile(FILE *fp, const char *name); PyAPI_FUNC(int) PyRun_AnyFileEx(FILE *fp, const char *name, int closeit); diff --git a/Modules/getpath.c b/Modules/getpath.c index f7a6dd40443054..1a12a2dc788ccb 100644 --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -1298,7 +1298,7 @@ calculate_zip_path(PyCalculatePath *calculate) /* Path: / "pythonXY.zip" */ wchar_t *path = joinpath2(calculate->platlibdir, - L"python" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) + L"python" Py_STRINGIFY(PY_MAJOR_VERSION) L"." Py_STRINGIFY(PY_MINOR_VERSION) L".zip"); if (path == NULL) { return _PyStatus_NO_MEMORY(); diff --git a/PC/getpathp.c b/PC/getpathp.c index 53da3a6d05faee..7b1f8877da241f 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -7,7 +7,7 @@ This describes how sys.path is formed on Windows. It describes the functionality, not the implementation (ie, the order in which these are actually fetched is different). The presence of a python._pth or - pythonXY._pth file alongside the program overrides these rules - see + python3.X._pth file alongside the program overrides these rules - see below. * Python always adds an empty entry at the start, which corresponds @@ -40,8 +40,8 @@ If a '._pth' file exists adjacent to the executable with the same base name (e.g. python._pth adjacent to python.exe) or adjacent to the shared library - (e.g. python36._pth adjacent to python36.dll), it is used in preference to - the above process. The shared library file takes precedence over the + (e.g. python3.10._pth adjacent to python3.10.dll), it is used in preference + to the above process. The shared library file takes precedence over the executable. The path file must contain a list of paths to add to sys.path, one per line. Each path is relative to the directory containing the file. Blank lines and comments beginning with '#' are permitted. @@ -1112,7 +1112,7 @@ _Py_CheckPython3(void) } python3_checked = 1; - /* If there is a python3.dll next to the python3y.dll, + /* If there is a python3.dll next to the python3.x.dll, use that DLL */ if (!get_dllpath(py3path)) { reduce(py3path); diff --git a/PC/pyconfig.h b/PC/pyconfig.h index aa1464425b5993..8053f20a9b47c4 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -269,11 +269,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ file in their Makefile (other compilers are generally taken care of by distutils.) */ # if defined(_DEBUG) -# pragma comment(lib,"python3_10_d.lib") +# pragma comment(lib,"python3.10_d.lib") # elif defined(Py_LIMITED_API) # pragma comment(lib,"python3.lib") # else -# pragma comment(lib,"python3_10.lib") +# pragma comment(lib,"python3.10.lib") # endif /* _DEBUG */ # endif /* _MSC_VER */ # endif /* Py_BUILD_CORE */ diff --git a/PC/readme.txt b/PC/readme.txt deleted file mode 100644 index 0a96d269b0977d..00000000000000 --- a/PC/readme.txt +++ /dev/null @@ -1,81 +0,0 @@ -Welcome to the "PC" subdirectory of the Python distribution -*********************************************************** - -This "PC" subdirectory contains complete project files to make -several older PC ports of Python, as well as all the PC-specific -Python source files. It should be located in the root of the -Python distribution, and there should be directories "Modules", -"Objects", "Python", etc. in the parent directory of this "PC" -subdirectory. Be sure to read the documentation in the Python -distribution. - -Python requires library files such as string.py to be available in -one or more library directories. The search path of libraries is -set up when Python starts. To see the current Python library search -path, start Python and enter "import sys" and "print sys.path". - -All PC ports use this scheme to try to set up a module search path: - - 1) The script location; the current directory without script. - 2) The PYTHONPATH variable, if set. - 3) For Win32 platforms (NT/95), paths specified in the Registry. - 4) Default directories lib, lib/win, lib/test, lib/tkinter; - these are searched relative to the environment variable - PYTHONHOME, if set, or relative to the executable and its - ancestors, if a landmark file (Lib/string.py) is found , - or the current directory (not useful). - 5) The directory containing the executable. - -The best installation strategy is to put the Python executable (and -DLL, for Win32 platforms) in some convenient directory such as -C:/python, and copy all library files and subdirectories (using XCOPY) -to C:/python/lib. Then you don't need to set PYTHONPATH. Otherwise, -set the environment variable PYTHONPATH to your Python search path. -For example, - set PYTHONPATH=.;d:\python\lib;d:\python\lib\win;d:\python\lib\dos-8x3 - -There are several add-in modules to build Python programs which use -the native Windows operating environment. The ports here just make -"QuickWin" and DOS Python versions which support a character-mode -(console) environment. Look in www.python.org for Tkinter, PythonWin, -WPY and wxPython. - -To make a Python port, start the Integrated Development Environment -(IDE) of your compiler, and read in the native "project file" -(or makefile) provided. This will enable you to change any source -files or build settings so you can make custom builds. - -pyconfig.h An important configuration file specific to PC's. - -config.c The list of C modules to include in the Python PC - version. Manually edit this file to add or - remove Python modules. - -testpy.py A Python test program. Run this to test your - Python port. It should produce copious output, - ending in a report on how many tests were OK, how many - failed, and how many were skipped. Don't worry about - skipped tests (these test unavailable optional features). - - -Additional files and subdirectories for 32-bit Windows -====================================================== - -python_nt.rc Resource compiler input for python15.dll. - -dl_nt.c - Additional sources used for 32-bit Windows features. - -getpathp.c Default sys.path calculations (for all PC platforms). - -dllbase_nt.txt A (manually maintained) list of base addresses for - various DLLs, to avoid run-time relocation. - - -Note for Windows 3.x and DOS users -================================== - -Neither Windows 3.x nor DOS is supported any more. The last Python -version that supported these was Python 1.5.2; the support files were -present in Python 2.0 but weren't updated, and it is not our intention -to support these platforms for Python 2.x. diff --git a/PC/testpy.py b/PC/testpy.py deleted file mode 100644 index 709f35c4525877..00000000000000 --- a/PC/testpy.py +++ /dev/null @@ -1,30 +0,0 @@ -import sys - -# This is a test module for Python. It looks in the standard -# places for various *.py files. If these are moved, you must -# change this module too. - -try: - import os -except: - print("""Could not import the standard "os" module. - Please check your PYTHONPATH environment variable.""") - sys.exit(1) - -try: - import symbol -except: - print("""Could not import the standard "symbol" module. If this is - a PC, you should add the dos_8x3 directory to your PYTHONPATH.""") - sys.exit(1) - -for dir in sys.path: - file = os.path.join(dir, "os.py") - if os.path.isfile(file): - test = os.path.join(dir, "test") - if os.path.isdir(test): - # Add the "test" directory to PYTHONPATH. - sys.path = sys.path + [test] - -import libregrtest # Standard Python tester. -libregrtest.main() diff --git a/PCbuild/python.props b/PCbuild/python.props index 4d6c7ff635db54..6a80063e4dcc26 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -202,7 +202,7 @@ $([msbuild]::Add($(Field3Value), 9000)) - python$(MajorVersionNumber)_$(MinorVersionNumber)$(PyDebugExt) + python$(MajorVersionNumber).$(MinorVersionNumber)$(PyDebugExt) python3$(PyDebugExt) diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index 73833d54637d5f..5bebfdd8f0f6aa 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -38,7 +38,7 @@ Debug Used to build Python with extra debugging capabilities, equivalent to using ./configure --with-pydebug on UNIX. All binaries built using this configuration have "_d" added to their name: - python310_d.dll, python_d.exe, parser_d.pyd, and so on. Both the + python3.10_d.dll, python_d.exe, parser_d.pyd, and so on. Both the build and rt (run test) batch files in this directory accept a -d option for debug builds. If you are building Python to help with development of CPython, you will most likely use this configuration. diff --git a/Programs/_freeze_importlib.c b/Programs/_freeze_importlib.c index 2e4ccbb154a414..dc9abfc8f519f4 100644 --- a/Programs/_freeze_importlib.c +++ b/Programs/_freeze_importlib.c @@ -21,7 +21,7 @@ static const struct _frozen _PyImport_FrozenModules[] = { }; #ifndef MS_WINDOWS -/* On Windows, this links with the regular pythonXY.dll, so this variable comes +/* On Windows, this links with the regular python3.X.dll, so this variable comes from frozen.obj. In the Makefile, frozen.o is not linked into this executable, so we define the variable here. */ const struct _frozen *PyImport_FrozenModules; diff --git a/Tools/msi/README.txt b/Tools/msi/README.txt index 82635f3d2c2a14..92b0d679b0a4c2 100644 --- a/Tools/msi/README.txt +++ b/Tools/msi/README.txt @@ -378,7 +378,7 @@ either "%SystemRoot%\System32" or "%SystemRoot%\SysWOW64" as appropriate. For the current user, they are installed in the Python install directory. -.\python3x.dll The core interpreter +.\python3.X.dll The core interpreter .\python3.dll The stable ABI reference When installed for all users, the following files are installed to diff --git a/Tools/msi/core/core_files.wxs b/Tools/msi/core/core_files.wxs index 106802b2fb5342..ac43cbfd78709c 100644 --- a/Tools/msi/core/core_files.wxs +++ b/Tools/msi/core/core_files.wxs @@ -6,14 +6,14 @@ - + - + @@ -23,8 +23,8 @@ - - + + diff --git a/Tools/msi/dev/dev_files.wxs b/Tools/msi/dev/dev_files.wxs index ed49c416e27f60..6b3a857fe4798d 100644 --- a/Tools/msi/dev/dev_files.wxs +++ b/Tools/msi/dev/dev_files.wxs @@ -14,7 +14,7 @@ - + @@ -25,7 +25,7 @@ - + From 696d90615578b96eb425c18085a2065e0f421a65 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 21 Oct 2020 18:13:29 +0100 Subject: [PATCH 16/19] Fix import checks --- Python/dynload_win.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Python/dynload_win.c b/Python/dynload_win.c index 5702ab2cd71ba1..fd343a08a73c6f 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -19,9 +19,9 @@ #endif #ifdef PYD_PLATFORM_TAG -#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd" +#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) "_" Py_STRINGIFY(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd" #else -#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) ".pyd" +#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) "_" Py_STRINGIFY(PY_MINOR_VERSION) ".pyd" #endif #define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd" @@ -135,12 +135,14 @@ static char *GetPythonImport (HINSTANCE hModule) /* Ensure python prefix is followed only by numbers to the end of the basename */ pch = import_name + 6; + while (*pch) { #ifdef _DEBUG - while (*pch && pch[0] != '_' && pch[1] != 'd' && pch[2] != '.') { + if (strcmp(pch, "_d.dll") == 0) { #else - while (*pch && *pch != '.') { + if (strcmp(pch, ".dll") == 0) { #endif - if (*pch >= '0' && *pch <= '9') { + break; + } else if (*pch == '.' || *pch >= '0' && *pch <= '9') { pch++; } else { pch = NULL; @@ -260,11 +262,11 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, PyOS_snprintf(buffer, sizeof(buffer), #ifdef _DEBUG - "python%d%d_d.dll", + "python%d.%d_d.dll", #else - "python%d%d.dll", + "python%d.%d.dll", #endif - PY_MAJOR_VERSION,PY_MINOR_VERSION); + PY_MAJOR_VERSION, PY_MINOR_VERSION); import_python = GetPythonImport(hDLL); if (import_python && From 8c4acb6a658dd6c984ea581a56cb9aafefb4cc04 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 22 Oct 2020 00:14:36 +0100 Subject: [PATCH 17/19] Fixed some comments and tests --- Lib/test/test_embed.py | 4 ++-- Lib/test/test_importlib/test_windows.py | 2 +- PCbuild/pcbuild.proj | 2 +- PCbuild/python.props | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index a7922182ba8bb0..74ff87ad1802da 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1172,9 +1172,9 @@ def tmpdir_with_python(self): tmpdir = os.path.realpath(tmpdir) if MS_WINDOWS: - # Copy pythonX_Y.dll (or pythonX_Y_d.dll) + # Copy python3.X.dll (or python3.X_d.dll) ver = sys.version_info - dll = f'python{ver.major}_{ver.minor}' + dll = f'python{ver.major}.{ver.minor}' dll3 = f'python{ver.major}' if debug_build(sys.executable): dll += '_d' diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py index 8b3f2009a850da..2170d11c477fc7 100644 --- a/Lib/test/test_importlib/test_windows.py +++ b/Lib/test/test_importlib/test_windows.py @@ -91,7 +91,7 @@ def test_module_not_found(self): class WindowsExtensionSuffixTests: def test_tagged_suffix(self): suffixes = self.machinery.EXTENSION_SUFFIXES - expected_tag = ".cp{0.major}{0.minor}-{1}.pyd".format(sys.version_info, + expected_tag = ".cp{0.major}_{0.minor}-{1}.pyd".format(sys.version_info, re.sub('[^a-zA-Z0-9]', '_', get_platform())) try: untagged_i = suffixes.index(".pyd") diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index f819c326e1e15b..7edc8506cb4d78 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -34,7 +34,7 @@ - + + python$(MajorVersionNumber).$(MinorVersionNumber)$(PyDebugExt) - + python3$(PyDebugExt) From c2d0c15b39480aabb5153129b3be798db2fb09ed Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 22 Oct 2020 16:46:22 +0100 Subject: [PATCH 18/19] Fix zip test --- Lib/test/test_embed.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 74ff87ad1802da..d9ef081865990f 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1155,7 +1155,7 @@ def module_search_paths(self, prefix=None, exec_prefix=None): ver = sys.version_info return [ os.path.join(prefix, sys.platlibdir, - f'python{ver.major}{ver.minor}.zip'), + f'python{ver.major}.{ver.minor}.zip'), os.path.join(prefix, sys.platlibdir, f'python{ver.major}.{ver.minor}'), os.path.join(exec_prefix, sys.platlibdir, From 106b6e2d5af2472f4fb27f872151c83e7182c9b1 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Thu, 22 Oct 2020 17:33:55 +0100 Subject: [PATCH 19/19] Fix DLL name mentions in doc --- Doc/extending/windows.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/extending/windows.rst b/Doc/extending/windows.rst index c04625bedfb514..f9d5d417a53c8d 100644 --- a/Doc/extending/windows.rst +++ b/Doc/extending/windows.rst @@ -110,9 +110,9 @@ may not work (though Borland seems to). The rest of this section is MSVC++ specific. When creating DLLs in Windows, the linker expects to see the import library -:file:`pythonX_Y.lib` in order to find all the C-API functions available in -:file:`pythonX_Y.dll` (or in the case of universal c-extensions, -:file:`pythonX.lib` and :file:`pythonX.dll` respectively. This is handled with +:file:`python3.X.lib` in order to find all the C-API functions available in +:file:`python3.X.dll` (or in the case of universal c-extensions, +:file:`python3.lib` and :file:`python3.dll` respectively. This is handled with a pragma in :file:`pyconfig.h` so you do not need to add anything special in your build.