Skip to content

Commit 3b5bc1a

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-08-20)
Summary: Imported python/cpython `3.16.0a0` from upstream rev [`04242c0`](https://www.github.com/python/cpython/commit/04242c027feeff726acb15b6463422897b489bcf) (committed 2026-08-20 19:24:45+00:00). # Commit Info - Base: (`3.16.0a0`) - [`bf95881`](https://www.github.com/python/cpython/commit/bf95881b84662d3dcd35143495b9880962164fee) (commit date: 2026-08-19 20:28:43+00:00) - Imported: (`3.16.0a0`) - [`04242c0`](https://www.github.com/python/cpython/commit/04242c027feeff726acb15b6463422897b489bcf) (commit date: 2026-08-20 19:24:45+00:00) # Noteworthy file changes - Test files (2 added) - Low-signal files (5 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GAvQeh7fKKlvDfsPAESrXTtu_sU9br0LAAAz Differential Revision: D116894938 fbshipit-source-id: 01e8d19fc5e4199a6d78729c15b52933029fd6c2
1 parent 178e23a commit 3b5bc1a

25 files changed

Lines changed: 242 additions & 110 deletions

Doc/about.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and now maintained as an independent project.
1010
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
1111
.. _Sphinx: https://www.sphinx-doc.org/
1212

13-
.. In the online version of these documents, you can submit comments and suggest
13+
.. In the online version of this documentation, you can submit comments and suggest
1414
changes directly on the documentation pages.
1515
1616
Development of the documentation and its toolchain is an entirely volunteer

Doc/c-api/import.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Importing Modules
146146
alternatives.
147147
148148
.. versionchanged:: 3.15
149-
``__cached__`` is no longer set.
149+
The ``__cached__`` attribute is no longer set.
150150
151151
152152
.. c:function:: PyObject* PyImport_ExecCodeModuleEx(const char *name, PyObject *co, const char *pathname)
@@ -170,7 +170,7 @@ Importing Modules
170170
:class:`~importlib.machinery.ModuleSpec` for alternatives.
171171
172172
.. versionchanged:: 3.15
173-
``__cached__`` no longer set.
173+
The ``__cached__`` attribute no longer set.
174174
175175
176176
.. c:function:: PyObject* PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, const char *pathname, const char *cpathname)

Doc/library/runpy.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The :mod:`!runpy` module provides two functions:
9797
:class:`~importlib.machinery.ModuleSpec` for alternatives.
9898

9999
.. versionchanged:: 3.15
100-
``__cached__`` is no longer set.
100+
The global variable ``__cached__`` is no longer set.
101101

102102
.. function:: run_path(path_name, init_globals=None, run_name=None)
103103

@@ -175,7 +175,7 @@ The :mod:`!runpy` module provides two functions:
175175
``__package__`` are deprecated.
176176

177177
.. versionchanged:: 3.15
178-
``__cached__`` is no longer set.
178+
The global variable ``__cached__`` is no longer set.
179179

180180
.. seealso::
181181

Doc/reference/datamodel.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,14 +1099,9 @@ this approach.
10991099
:ref:`import system <importsystem>` may opt to leave it unset if it
11001100
has no semantic meaning (for example, a module loaded from a database).
11011101

1102-
.. deprecated-removed:: 3.13 3.15
1103-
Setting ``__cached__`` on a module while failing to set
1104-
:attr:`!__spec__.cached` is deprecated. In Python 3.15,
1105-
``__cached__`` will cease to be set or taken into consideration by
1106-
the import system or standard library.
1107-
1108-
.. versionchanged:: 3.15
1109-
``__cached__`` is no longer set.
1102+
.. versionchanged:: 3.15
1103+
The ``__cached__`` attribute is no longer set on modules or taken into
1104+
consideration by the import system or standard library.
11101105

11111106
Other writable attributes on module objects
11121107
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Doc/tools/templates/indexsidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h3>{% trans %}Download{% endtrans %}</h3>
2-
<p><a href="{{ pathto('download') }}">{% trans %}Download these documents{% endtrans %}</a></p>
2+
<p><a href="{{ pathto('download') }}">{% trans %}Download the documentation{% endtrans %}</a></p>
33
<h3>{% trans %}Docs by version{% endtrans %}</h3>
44
<ul>
55
{# _docs_by_version.html is overwritten by build_docs.py for non-EOL versions #}

Doc/tutorial/stdlib.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ aids for working with large modules like :mod:`os`::
3636
<returns an extensive manual page created from the module's docstrings>
3737

3838
For daily file and directory management tasks, the :mod:`shutil` module provides
39-
a higher level interface that is easier to use::
39+
a higher-level interface that is easier to use::
4040

4141
>>> import shutil
4242
>>> shutil.copyfile('data.db', 'archive.db')
@@ -63,7 +63,7 @@ wildcard searches::
6363
Command-line arguments
6464
======================
6565

66-
Common utility scripts often need to process command line arguments. These
66+
Common utility scripts often need to process command-line arguments. These
6767
arguments are stored in the :mod:`sys` module's *argv* attribute as a list. For
6868
instance, let's take the following :file:`demo.py` file::
6969

@@ -77,7 +77,7 @@ line::
7777
['demo.py', 'one', 'two', 'three']
7878

7979
The :mod:`argparse` module provides a more sophisticated mechanism to process
80-
command line arguments. The following script extracts one or more filenames
80+
command-line arguments. The following script extracts one or more filenames
8181
and an optional number of lines to be displayed::
8282

8383
import argparse

Doc/whatsnew/3.15.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,14 @@ Other language changes
880880
other, as regular dynamic extensions do.
881881
(Contributed by Stefano Rivera in :gh:`122931`.)
882882

883+
* The ``__cached__`` attribute on modules, which was deprecated since version
884+
3.13, is no longer set or taken into consideration by the import system or
885+
standard library.
886+
Use :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` instead.
887+
(Contributed by Brett Cannon in :gh:`97879`)
888+
889+
Note that the :attr:`~module.__loader__` and :attr:`~module.__package__`
890+
attributes are also deprecated and scheduled for removal.
883891

884892

885893
Default interactive shell

Lib/test/test_curses.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,21 @@ def test_output_string_embedded_null_chars(self):
895895
self.assertRaises(ValueError, stdscr.insstr, arg)
896896
self.assertRaises(ValueError, stdscr.insnstr, arg, 1)
897897

898+
def test_output_string_attr_restored(self):
899+
# A write with an attr restores the window rendition afterwards,
900+
# whether it succeeded or failed.
901+
win = curses.newwin(2, 10, 0, 0)
902+
for func, args in [(win.addstr, ('x',)), (win.addnstr, ('x', 1)),
903+
(win.insstr, ('x',)), (win.insnstr, ('x', 1))]:
904+
with self.subTest(func.__qualname__):
905+
win.attrset(curses.A_UNDERLINE)
906+
# y=100 is outside the window, so the write fails.
907+
self.assertRaises(curses.error, func, 100, 0, *args,
908+
curses.A_BOLD)
909+
self.assertEqual(win.getattrs(), curses.A_UNDERLINE)
910+
func(0, 0, *args, curses.A_BOLD)
911+
self.assertEqual(win.getattrs(), curses.A_UNDERLINE)
912+
898913
def test_add_string_behavior(self):
899914
# addstr() advances the cursor past the written text; addnstr()
900915
# writes at most n characters.

Lib/test/test_free_threading/test_gc.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import threading
44
from threading import Thread
5+
import time
56
from unittest import TestCase
67
import gc
78

@@ -94,6 +95,26 @@ def evil():
9495
thread.start()
9596
thread.join()
9697

98+
def test_gc_callbacks_race_with_mutation(self):
99+
def collect():
100+
b.wait()
101+
while not stop.is_set():
102+
gc.collect()
103+
104+
def mutate():
105+
b.wait()
106+
while not stop.is_set():
107+
gc.callbacks[:] = [lambda *_: _ for _ in range(16)]
108+
time.sleep(0)
109+
gc.callbacks.clear()
110+
111+
threads = [threading.Thread(target=f) for f in (collect, mutate) * 4]
112+
b = threading.Barrier(len(threads) + 1)
113+
stop = threading.Event()
114+
115+
with threading_helper.start_threads(threads, stop.set):
116+
b.wait()
117+
time.sleep(0.2)
97118
def test_set_threshold(self):
98119
# GH-148613: Setting the GC threshold from another thread could cause a
99120
# race between the `gc_should_collect` and `gc_set_threshold` functions.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#: noheader.py:3
2+
msgid "Foo"
3+
msgstr ""
4+
5+
#: noheader.py:5
6+
msgid "Bar"
7+
msgstr ""
8+

0 commit comments

Comments
 (0)