Skip to content

Commit c4f9db1

Browse files
Merge branch 'main' into HEAD
2 parents 9efe805 + cb39410 commit c4f9db1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2330
-1131
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Objects/type* @markshannon
3535
Objects/codeobject.c @markshannon
3636
Objects/frameobject.c @markshannon
3737
Objects/call.c @markshannon
38+
Objects/object.c @ZeroIntensity
3839
Python/ceval*.c @markshannon
3940
Python/ceval*.h @markshannon
4041
Python/codegen.c @markshannon @iritkatriel
@@ -66,8 +67,8 @@ Doc/_static/** @AA-Turner @hugovk
6667
Doc/tools/** @AA-Turner @hugovk
6768

6869
# runtime state/lifecycle
69-
**/*pylifecycle* @ericsnowcurrently
70-
**/*pystate* @ericsnowcurrently
70+
**/*pylifecycle* @ericsnowcurrently @ZeroIntensity
71+
**/*pystate* @ericsnowcurrently @ZeroIntensity
7172
**/*preconfig* @ericsnowcurrently
7273
**/*initconfig* @ericsnowcurrently
7374
**/*pathconfig* @ericsnowcurrently

Doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
rst_epilog = f"""
8080
.. |python_version_literal| replace:: ``Python {version}``
8181
.. |python_x_dot_y_literal| replace:: ``python{version}``
82+
.. |python_x_dot_y_t_literal| replace:: ``python{version}t``
83+
.. |python_x_dot_y_t_literal_config| replace:: ``python{version}t-config``
84+
.. |x_dot_y_b2_literal| replace:: ``{version}.0b2``
85+
.. |applications_python_version_literal| replace:: ``/Applications/Python {version}/``
8286
.. |usr_local_bin_python_x_dot_y_literal| replace:: ``/usr/local/bin/python{version}``
8387
8488
.. Apparently this how you hack together a formatted link:

Doc/using/mac.rst

Lines changed: 57 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ the Pythons provided by the CPython release team for download from
2020
the `python.org website <https://www.python.org/downloads/>`_. See
2121
:ref:`alternative_bundles` for some other options.
2222

23-
.. |usemac_x_dot_y| replace:: 3.13
24-
.. |usemac_python_x_dot_y_literal| replace:: ``python3.13``
25-
.. |usemac_python_x_dot_y_t_literal| replace:: ``python3.13t``
26-
.. |usemac_python_x_dot_y_t_literal_config| replace:: ``python3.13t-config``
27-
.. |usemac_applications_folder_name| replace:: ``Python 3.13``
28-
.. |usemac_applications_folder_version| replace:: ``/Applications/Python 3.13/``
29-
3023
.. _getting-osx:
3124
.. _getting-and-installing-macpython:
3225

@@ -64,7 +57,7 @@ Clicking on the **Continue** button brings up the **Read Me** for this installer
6457
Besides other important information, the **Read Me** documents which Python version is
6558
going to be installed and on what versions of macOS it is supported. You may need
6659
to scroll through to read the whole file. By default, this **Read Me** will also be
67-
installed in |usemac_applications_folder_version| and available to read anytime.
60+
installed in |applications_python_version_literal| and available to read anytime.
6861

6962
.. image:: mac_installer_02_readme.png
7063

@@ -83,7 +76,7 @@ display. For most uses, the standard set of installation operations is appropria
8376
By pressing the **Customize** button, you can choose to omit or select certain package
8477
components of the installer. Click on each package name to see a description of
8578
what it installs.
86-
To also install support for the optional experimental free-threaded feature,
79+
To also install support for the optional free-threaded feature,
8780
see :ref:`install-freethreaded-macos`.
8881

8982
.. image:: mac_installer_05_custom_install.png
@@ -97,7 +90,7 @@ When the installation is complete, the **Summary** window will appear.
9790
.. image:: mac_installer_06_summary.png
9891

9992
Double-click on the :command:`Install Certificates.command`
100-
icon or file in the |usemac_applications_folder_version| window to complete the
93+
icon or file in the |applications_python_version_literal| window to complete the
10194
installation.
10295

10396
.. image:: mac_installer_07_applications.png
@@ -114,7 +107,7 @@ Close this terminal window and the installer window.
114107

115108
A default install will include:
116109

117-
* A |usemac_applications_folder_name| folder in your :file:`Applications` folder. In here
110+
* A |python_version_literal| folder in your :file:`Applications` folder. In here
118111
you find :program:`IDLE`, the development environment that is a standard part of official
119112
Python distributions; and :program:`Python Launcher`, which handles double-clicking Python
120113
scripts from the macOS `Finder <https://support.apple.com/en-us/HT201732>`_.
@@ -141,7 +134,7 @@ How to run a Python script
141134

142135
There are two ways to invoke the Python interpreter.
143136
If you are familiar with using a Unix shell in a terminal
144-
window, you can invoke |usemac_python_x_dot_y_literal| or ``python3`` optionally
137+
window, you can invoke |python_x_dot_y_literal| or ``python3`` optionally
145138
followed by one or more command line options (described in :ref:`using-on-general`).
146139
The Python tutorial also has a useful section on
147140
:ref:`using Python interactively from a shell <tut-interac>`.
@@ -160,7 +153,7 @@ for more information.
160153
To run a Python script file from the terminal window, you can
161154
invoke the interpreter with the name of the script file:
162155

163-
|usemac_python_x_dot_y_literal| ``myscript.py``
156+
|python_x_dot_y_literal| ``myscript.py``
164157

165158
To run your script from the Finder, you can either:
166159

@@ -259,20 +252,20 @@ Advanced Topics
259252
Installing Free-threaded Binaries
260253
---------------------------------
261254

262-
.. versionadded:: 3.13 (Experimental)
263-
264-
.. note::
265-
266-
Everything described in this section is considered experimental,
267-
and should be expected to change in future releases.
255+
.. versionadded:: 3.13
268256

269257
The ``python.org`` :ref:`Python for macOS <getting-and-installing-macpython>`
270258
installer package can optionally install an additional build of
271-
Python |usemac_x_dot_y| that supports :pep:`703`, the experimental free-threading feature
259+
Python |version| that supports :pep:`703`, the free-threading feature
272260
(running with the :term:`global interpreter lock` disabled).
273261
Check the release page on ``python.org`` for possible updated information.
274262

275-
Because this feature is still considered experimental, the support for it
263+
The free-threaded mode is working and continues to be improved, but
264+
there is some additional overhead in single-threaded workloads compared
265+
to the regular build. Additionally, third-party packages, in particular ones
266+
with an :term:`extension module`, may not be ready for use in a
267+
free-threaded build, and will re-enable the :term:`GIL`.
268+
Therefore, the support for free-threading
276269
is not installed by default. It is packaged as a separate install option,
277270
available by clicking the **Customize** button on the **Installation Type**
278271
step of the installer as described above.
@@ -282,46 +275,54 @@ step of the installer as described above.
282275
If the box next to the **Free-threaded Python** package name is checked,
283276
a separate :file:`PythonT.framework` will also be installed
284277
alongside the normal :file:`Python.framework` in :file:`/Library/Frameworks`.
285-
This configuration allows a free-threaded Python |usemac_x_dot_y| build to co-exist
286-
on your system with a traditional (GIL only) Python |usemac_x_dot_y| build with
287-
minimal risk while installing or testing. This installation layout is itself
288-
experimental and is subject to change in future releases.
278+
This configuration allows a free-threaded Python |version| build to co-exist
279+
on your system with a traditional (GIL only) Python |version| build with
280+
minimal risk while installing or testing. This installation layout may
281+
change in future releases.
289282

290283
Known cautions and limitations:
291284

292285
- The **UNIX command-line tools** package, which is selected by default,
293-
will install links in :file:`/usr/local/bin` for |usemac_python_x_dot_y_t_literal|,
294-
the free-threaded interpreter, and |usemac_python_x_dot_y_t_literal_config|,
286+
will install links in :file:`/usr/local/bin` for |python_x_dot_y_t_literal|,
287+
the free-threaded interpreter, and |python_x_dot_y_t_literal_config|,
295288
a configuration utility which may be useful for package builders.
296289
Since :file:`/usr/local/bin` is typically included in your shell ``PATH``,
297290
in most cases no changes to your ``PATH`` environment variables should
298-
be needed to use |usemac_python_x_dot_y_t_literal|.
291+
be needed to use |python_x_dot_y_t_literal|.
299292

300293
- For this release, the **Shell profile updater** package and the
301-
:file:`Update Shell Profile.command` in |usemac_applications_folder_version|
294+
:file:`Update Shell Profile.command` in |applications_python_version_literal|
302295
do not support the free-threaded package.
303296

304297
- The free-threaded build and the traditional build have separate search
305298
paths and separate :file:`site-packages` directories so, by default,
306299
if you need a package available in both builds, it may need to be installed in both.
307300
The free-threaded package will install a separate instance of :program:`pip` for use
308-
with |usemac_python_x_dot_y_t_literal|.
301+
with |python_x_dot_y_t_literal|.
309302

310303
- To install a package using :command:`pip` without a :command:`venv`:
311304

312-
|usemac_python_x_dot_y_t_literal| ``-m pip install <package_name>``
305+
.. parsed-literal::
306+
307+
python\ |version|\ t -m pip install <package_name>
313308
314309
- When working with multiple Python environments, it is usually safest and easiest
315310
to :ref:`create and use virtual environments <tut-venv>`.
316311
This can avoid possible command name conflicts and confusion about which Python is in use:
317312

318-
|usemac_python_x_dot_y_t_literal| ``-m venv <venv_name>``
313+
.. parsed-literal::
314+
315+
python\ |version|\ t -m venv <venv_name>
316+
319317
320318
then :command:`activate`.
321319

322320
- To run a free-threaded version of IDLE:
323321

324-
|usemac_python_x_dot_y_t_literal| ``-m idlelib``
322+
.. parsed-literal::
323+
324+
python\ |version|\ t -m idlelib
325+
325326
326327
- The interpreters in both builds respond to the same
327328
:ref:`PYTHON environment variables <using-on-envvars>`
@@ -337,28 +338,28 @@ Known cautions and limitations:
337338
thus it only needs to be run once.
338339

339340
- If you cannot depend on the link in ``/usr/local/bin`` pointing to the
340-
``python.org`` free-threaded |usemac_python_x_dot_y_t_literal| (for example, if you want
341+
``python.org`` free-threaded |python_x_dot_y_t_literal| (for example, if you want
341342
to install your own version there or some other distribution does),
342343
you can explicitly set your shell ``PATH`` environment variable to
343344
include the ``PythonT`` framework ``bin`` directory:
344345

345-
.. code-block:: sh
346+
.. parsed-literal::
346347
347-
export PATH="/Library/Frameworks/PythonT.framework/Versions/3.13/bin":"$PATH"
348+
export PATH="/Library/Frameworks/PythonT.framework/Versions/\ |version|\ /bin":"$PATH"
348349
349350
The traditional framework installation by default does something similar,
350351
except for :file:`Python.framework`. Be aware that having both framework ``bin``
351352
directories in ``PATH`` can lead to confusion if there are duplicate names
352-
like ``python3.13`` in both; which one is actually used depends on the order
353+
like |python_x_dot_y_literal| in both; which one is actually used depends on the order
353354
they appear in ``PATH``. The ``which python3.x`` or ``which python3.xt``
354355
commands can show which path is being used. Using virtual environments
355356
can help avoid such ambiguities. Another option might be to create
356357
a shell :command:`alias` to the desired interpreter, like:
357358

358-
.. code-block:: sh
359+
.. parsed-literal::
359360
360-
alias py3.13="/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13"
361-
alias py3.13t="/Library/Frameworks/PythonT.framework/Versions/3.13/bin/python3.13t"
361+
alias py\ |version|\ ="/Library/Frameworks/Python.framework/Versions/\ |version|\ /bin/python\ |version|\ "
362+
alias py\ |version|\ t="/Library/Frameworks/PythonT.framework/Versions/\ |version|\ /bin/python\ |version|\ t"
362363
363364
Installing using the command line
364365
---------------------------------
@@ -369,22 +370,22 @@ the macOS command line :command:`installer` utility lets you select non-default
369370
options, too. If you are not familiar with :command:`installer`, it can be
370371
somewhat cryptic (see :command:`man installer` for more information).
371372
As an example, the following shell snippet shows one way to do it,
372-
using the ``3.13.0b2`` release and selecting the free-threaded interpreter
373+
using the |x_dot_y_b2_literal| release and selecting the free-threaded interpreter
373374
option:
374375

375-
.. code-block:: sh
376+
.. parsed-literal::
376377
377-
RELEASE="python-3.13.0b2-macos11.pkg"
378+
RELEASE="python-\ |version|\ 0b2-macos11.pkg"
378379
379380
# download installer pkg
380-
curl -O https://www.python.org/ftp/python/3.13.0/${RELEASE}
381+
curl -O \https://www.python.org/ftp/python/\ |version|\ .0/${RELEASE}
381382
382383
# create installer choicechanges to customize the install:
383-
# enable the PythonTFramework-3.13 package
384+
# enable the PythonTFramework-\ |version|\ package
384385
# while accepting the other defaults (install all other packages)
385386
cat > ./choicechanges.plist <<EOF
386387
<?xml version="1.0" encoding="UTF-8"?>
387-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
388+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "\http://www.apple.com/DTDs/PropertyList-1.0.dtd">
388389
<plist version="1.0">
389390
<array>
390391
<dict>
@@ -393,7 +394,7 @@ option:
393394
<key>choiceAttribute</key>
394395
<string>selected</string>
395396
<key>choiceIdentifier</key>
396-
<string>org.python.Python.PythonTFramework-3.13</string>
397+
<string>org.python.Python.PythonTFramework-\ |version|\ </string>
397398
</dict>
398399
</array>
399400
</plist>
@@ -404,19 +405,19 @@ option:
404405
405406
You can then test that both installer builds are now available with something like:
406407

407-
.. code-block:: console
408+
.. parsed-literal::
408409
409410
$ # test that the free-threaded interpreter was installed if the Unix Command Tools package was enabled
410-
$ /usr/local/bin/python3.13t -VV
411-
Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
411+
$ /usr/local/bin/python\ |version|\ t -VV
412+
Python \ |version|\ .0b2 free-threading build (v\ |version|\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
412413
$ # and the traditional interpreter
413-
$ /usr/local/bin/python3.13 -VV
414-
Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
414+
$ /usr/local/bin/python\ |version|\ -VV
415+
Python \ |version|\ .0b2 (v\ |version|\ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
415416
$ # test that they are also available without the prefix if /usr/local/bin is on $PATH
416-
$ python3.13t -VV
417-
Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
418-
$ python3.13 -VV
419-
Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
417+
$ python\ |version|\ t -VV
418+
Python \ |version|\ .0b2 free-threading build (v\ |version|\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]
419+
$ python\ |version|\ -VV
420+
Python \ |version|\ .0b2 (v\ |version|\ .0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]
420421
421422
.. note::
422423

Doc/whatsnew/3.14.rst

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ and improvements in user-friendliness and correctness.
8282

8383
.. PEP-sized items next.
8484
85+
* :ref:`PEP 779: Free-threaded Python is officially supported <whatsnew314-pep779>`
8586
* :ref:`PEP 649 and 749: deferred evaluation of annotations <whatsnew314-pep649>`
86-
* :ref:`PEP 734: Multiple Interpreters in the Stdlib <whatsnew314-pep734>`
87-
* :ref:`PEP 741: Python Configuration C API <whatsnew314-pep741>`
87+
* :ref:`PEP 734: Multiple interpreters in the stdlib <whatsnew314-pep734>`
88+
* :ref:`PEP 741: Python configuration C API <whatsnew314-pep741>`
8889
* :ref:`PEP 750: Template strings <whatsnew314-pep750>`
8990
* :ref:`PEP 758: Allow except and except* expressions without parentheses <whatsnew314-pep758>`
9091
* :ref:`PEP 761: Discontinuation of PGP signatures <whatsnew314-pep761>`
@@ -124,9 +125,35 @@ of Python. See :ref:`below <whatsnew314-refcount>` for details.
124125
New features
125126
============
126127

128+
.. _whatsnew314-pep779:
129+
130+
PEP 779: Free-threaded Python is officially supported
131+
-----------------------------------------------------
132+
133+
The free-threaded build of Python is now supported and no longer experimental.
134+
This is the start of phase II where free-threaded Python is officially supported
135+
but still optional.
136+
137+
We are confident that the project is on the right path, and we appreciate the
138+
continued dedication from everyone working to make free-threading ready for
139+
broader adoption across the Python community.
140+
141+
With these recommendations and the acceptance of this PEP, we as the Python
142+
developer community should broadly advertise that free-threading is a supported
143+
Python build option now and into the future, and that it will not be removed
144+
without a proper deprecation schedule.
145+
146+
Any decision to transition to phase III, with free-threading as the default or
147+
sole build of Python is still undecided, and dependent on many factors both
148+
within CPython itself and the community. This decision is for the future.
149+
150+
.. seealso::
151+
:pep:`779` and its `acceptance
152+
<https://discuss.python.org/t/pep-779-criteria-for-supported-status-for-free-threaded-python/84319/123>`__.
153+
127154
.. _whatsnew314-pep734:
128155

129-
PEP 734: Multiple Interpreters in the Stdlib
156+
PEP 734: Multiple interpreters in the stdlib
130157
--------------------------------------------
131158

132159
The CPython runtime supports running multiple copies of Python in the
@@ -392,7 +419,7 @@ As can be seen, the API is similar to the APIs of the :mod:`!lzma` and
392419
:mod:`!bz2` modules.
393420

394421
(Contributed by Emma Harper Smith, Adam Turner, Gregory P. Smith, Tomas Roun,
395-
Victor Stinner, and Rogdham in :gh:`132983`)
422+
Victor Stinner, and Rogdham in :gh:`132983`.)
396423

397424
.. seealso::
398425
:pep:`784`.
@@ -727,7 +754,7 @@ Improved error messages
727754
728755
.. _whatsnew314-pep741:
729756

730-
PEP 741: Python Configuration C API
757+
PEP 741: Python configuration C API
731758
-----------------------------------
732759

733760
Add a :ref:`PyInitConfig C API <pyinitconfig_api>` to configure the Python
@@ -1266,7 +1293,7 @@ configparser
12661293
to :meth:`configparser.ConfigParser.write` keys containing delimiters or
12671294
beginning with the section header pattern will raise a
12681295
:class:`configparser.InvalidWriteError`.
1269-
(Contributed by Jacob Lincoln in :gh:`129270`)
1296+
(Contributed by Jacob Lincoln in :gh:`129270`.)
12701297

12711298
contextvars
12721299
-----------
@@ -2755,8 +2782,8 @@ New features
27552782

27562783
* Add :c:func:`PyType_GetBaseByToken` and :c:data:`Py_tp_token` slot for easier
27572784
superclass identification, which attempts to resolve the `type checking issue
2758-
<https://peps.python.org/pep-0630/#type-checking>`__ mentioned in :pep:`630`
2759-
(:gh:`124153`).
2785+
<https://peps.python.org/pep-0630/#type-checking>`__ mentioned in :pep:`630`.
2786+
(Contributed in :gh:`124153`.)
27602787

27612788
* Add :c:func:`PyUnicode_Equal` function to the limited C API:
27622789
test if two strings are equal.

0 commit comments

Comments
 (0)