Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40747: Make py_version_nodot 3_10 not 310 (PEP 641) #22858

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Doc/c-api/stable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Doc/faq/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Doc/using/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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`.

Expand Down
9 changes: 9 additions & 0 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Include/pythonrun.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Modules/getpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ calculate_zip_path(PyCalculatePath *calculate)

/* Path: <platlibdir> / "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();
Expand Down
8 changes: 4 additions & 4 deletions PC/getpathp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions PC/pyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn’t it be better to consistently use _ everywhere? Then no one has to think which to use.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other platforms already use dots in the equivalent filename. We decided on consistency there (though if I can't fix the crashes, we may roll back this part entirely and just change packaging stuff).

# 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 */
Expand Down
81 changes: 0 additions & 81 deletions PC/readme.txt

This file was deleted.

30 changes: 0 additions & 30 deletions PC/testpy.py

This file was deleted.

2 changes: 1 addition & 1 deletion PCbuild/python.props
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>

<!-- The name of the resulting pythonX_Y.dll (without the extension) -->
zooba marked this conversation as resolved.
Show resolved Hide resolved
<PyDllName>python$(MajorVersionNumber)_$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
<PyDllName>python$(MajorVersionNumber).$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
<!-- The name of the resulting pythonX.dll (without the extension) -->
<Py3DllName>python3$(PyDebugExt)</Py3DllName>

Expand Down
2 changes: 1 addition & 1 deletion PCbuild/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Programs/_freeze_importlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Tools/msi/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Tools/msi/core/core_files.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<File Id="python_stable.dll" Name="python$(var.MajorVersionNumber).dll" KeyPath="yes" />
</Component>
<Component Id="python.dll" Directory="InstallDirectory" Guid="*">
<File Id="python.dll" Name="python$(var.MajorVersionNumber)_$(var.MinorVersionNumber).dll" KeyPath="yes" />
<File Id="python.dll" Name="python$(var.MajorVersionNumber).$(var.MinorVersionNumber).dll" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="core_symbols">
<Component Id="python.pdb" Directory="InstallDirectory" Guid="*">
<File Id="python.pdb" Name="python$(var.MajorVersionNumber)_$(var.MinorVersionNumber).pdb" KeyPath="yes" />
<File Id="python.pdb" Name="python$(var.MajorVersionNumber).$(var.MinorVersionNumber).pdb" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
Expand All @@ -23,8 +23,8 @@
<File Id="python_stable_d.dll" Name="python$(var.MajorVersionNumber)_d.dll" KeyPath="yes" />
</Component>
<Component Id="python_d.dll" Directory="InstallDirectory" Guid="*">
<File Id="python_d.dll" Name="python$(var.MajorVersionNumber)_$(var.MinorVersionNumber)_d.dll" KeyPath="yes" />
<File Id="python_d.pdb" Name="python$(var.MajorVersionNumber)_$(var.MinorVersionNumber)_d.pdb" KeyPath="no" />
<File Id="python_d.dll" Name="python$(var.MajorVersionNumber).$(var.MinorVersionNumber)_d.dll" KeyPath="yes" />
<File Id="python_d.pdb" Name="python$(var.MajorVersionNumber).$(var.MinorVersionNumber)_d.pdb" KeyPath="no" />
</Component>
</ComponentGroup>
</Fragment>
Expand Down
4 changes: 2 additions & 2 deletions Tools/msi/dev/dev_files.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<File Id="libs_python_stable.lib" Name="python$(var.MajorVersionNumber).lib" KeyPath="yes" />
</Component>
<Component Id="libs_python.lib" Directory="libs" Guid="*">
<File Id="libs_python.lib" Name="python$(var.MajorVersionNumber)_$(var.MinorVersionNumber).lib" KeyPath="yes" />
<File Id="libs_python.lib" Name="python$(var.MajorVersionNumber).$(var.MinorVersionNumber).lib" KeyPath="yes" />
</Component>
</ComponentGroup>
</Fragment>
Expand All @@ -25,7 +25,7 @@
<File Id="libs_python_stable_d.lib" Name="python$(var.MajorVersionNumber)_d.lib" />
</Component>
<Component Id="libs_python_d.lib" Directory="libs" Guid="*">
<File Id="libs_python_d.lib" Name="python$(var.MajorVersionNumber)_$(var.MinorVersionNumber)_d.lib" />
<File Id="libs_python_d.lib" Name="python$(var.MajorVersionNumber).$(var.MinorVersionNumber)_d.lib" />
</Component>
</ComponentGroup>
</Fragment>
Expand Down