Skip to content

Commit b391bc9

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-11-02)
Summary: Imported python/cpython `3.16.0a1+dev` from upstream rev [`3945eaf`](https://www.github.com/python/cpython/commit/3945eaf2fcd9cbc3f3061275bd29751c8b2e7d3b) (committed 2026-11-02 23:08:42+00:00). # Commit Info - Base: (`3.16.0a1+dev`) - [`67683da`](https://www.github.com/python/cpython/commit/67683da0ec8368c302569ff87af30fa1da2f873b) (commit date: 2026-11-02 05:50:10+00:00) - Imported: (`3.16.0a1+dev`) - [`3945eaf`](https://www.github.com/python/cpython/commit/3945eaf2fcd9cbc3f3061275bd29751c8b2e7d3b) (commit date: 2026-11-02 23:08:42+00:00) # Noteworthy file changes - Native files (1 added): ``` + Modules/expat/entities.h ``` - Stdlib files (1 added, 1 removed) - Low-signal files (9 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GPz1KzPNFm4hXrcQAKEfJks7bFEsbr0LAAAz Differential Revision: D129282297 fbshipit-source-id: 7f92065f2025a941c741262a275078995dbafe38
1 parent de6e261 commit b391bc9

65 files changed

Lines changed: 2223 additions & 749 deletions

File tree

Some content is hidden

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

‎.github/workflows/reusable-macos.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
--enable-slower-safety \
5252
--enable-safety \
5353
${{ inputs.free-threading && '--disable-gil' || '' }} \
54+
--with-tail-call-interp \
5455
--prefix=/opt/python-dev \
5556
--with-openssl="$(brew --prefix openssl@3.5)"
5657
- name: Build CPython

‎.github/workflows/tail-call.yml‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,6 @@ env:
2323
LLVM_VERSION: 21
2424

2525
jobs:
26-
macos:
27-
name: aarch64-apple-darwin/clang
28-
runs-on: macos-26
29-
timeout-minutes: 60
30-
steps:
31-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32-
with:
33-
persist-credentials: false
34-
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
35-
with:
36-
python-version: '3.11'
37-
- name: Install dependencies
38-
run: |
39-
brew update
40-
brew install llvm@${{ env.LLVM_VERSION }}
41-
- name: Build
42-
run: |
43-
export SDKROOT="$(xcrun --show-sdk-path)"
44-
export PATH="/opt/homebrew/opt/llvm@${{ env.LLVM_VERSION }}/bin:$PATH"
45-
CC=clang-${{ env.LLVM_VERSION }} ./configure --with-tail-call-interp
46-
make all --jobs 4
47-
- name: Test
48-
run: |
49-
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
50-
5126
linux:
5227
name: ${{ matrix.target }}
5328
runs-on: ${{ matrix.runner }}

‎Doc/conf.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,11 @@
608608
r'https://unix.org/version2/whatsnew/lp64_wp.html',
609609
]
610610

611+
# Options to adjust search results sorting
612+
# ----------------------------------------
613+
614+
html_search_scorer = "tools/static/search_scorer.js"
615+
611616

612617
# Options for sphinx.ext.extlinks
613618
# -------------------------------

‎Doc/pylock.toml‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e
167167

168168
[[packages]]
169169
name = "docutils"
170-
version = "0.21.2"
171-
sdist = { url = "https://files.pythonhosted.org/packages/ae/ed/aefcc8cd0ba62a0560c3c18c33925362d46c6075480bfa4df87b28e169a9/docutils-0.21.2.tar.gz", upload-time = 2024-04-23T18:57:18Z, size = 2204444, hashes = { sha256 = "3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f" } }
172-
wheels = [{ url = "https://files.pythonhosted.org/packages/8f/d7/9322c609343d929e75e7e5e6255e614fcc67572cfd083959cdef3b7aad79/docutils-0.21.2-py3-none-any.whl", upload-time = 2024-04-23T18:57:14Z, size = 587408, hashes = { sha256 = "dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2" } }]
170+
version = "0.22.4"
171+
sdist = { url = "https://files.pythonhosted.org/packages/ae/b6/03bb70946330e88ffec97aefd3ea75ba575cb2e762061e0e62a213befee8/docutils-0.22.4.tar.gz", upload-time = 2025-12-18T19:00:26Z, size = 2291750, hashes = { sha256 = "4db53b1fde9abecbb74d91230d32ab626d94f6badfc575d6db9194a49df29968" } }
172+
wheels = [{ url = "https://files.pythonhosted.org/packages/02/10/5da547df7a391dcde17f59520a231527b8571e6f46fc8efb02ccb370ab12/docutils-0.22.4-py3-none-any.whl", upload-time = 2025-12-18T19:00:18Z, size = 633196, hashes = { sha256 = "d0013f540772d1420576855455d050a2180186c91c15779301ac2ccb3eeb68de" } }]
173173

174174
[[packages]]
175175
name = "idna"
@@ -236,12 +236,6 @@ version = "4.1.0"
236236
sdist = { url = "https://files.pythonhosted.org/packages/ae/f9/41dc953bbeb056c17d5f7a519f50fdf010bd0553be2d630bc69d1e022703/roman_numerals-4.1.0.tar.gz", upload-time = 2025-12-17T18:25:34Z, size = 9077, hashes = { sha256 = "1af8b147eb1405d5839e78aeb93131690495fe9da5c91856cb33ad55a7f1e5b2" } }
237237
wheels = [{ url = "https://files.pythonhosted.org/packages/04/54/6f679c435d28e0a568d8e8a7c0a93a09010818634c3c3907fc98d8983770/roman_numerals-4.1.0-py3-none-any.whl", upload-time = 2025-12-17T18:25:33Z, size = 7676, hashes = { sha256 = "647ba99caddc2cc1e55a51e4360689115551bf4476d90e8162cf8c345fe233c7" } }]
238238

239-
[[packages]]
240-
name = "roman-numerals-py"
241-
version = "4.1.0"
242-
sdist = { url = "https://files.pythonhosted.org/packages/cb/b5/de96fca640f4f656eb79bbee0e79aeec52e3e0e359f8a3e6a0d366378b64/roman_numerals_py-4.1.0.tar.gz", upload-time = 2025-12-17T18:25:41Z, size = 4274, hashes = { sha256 = "f5d7b2b4ca52dd855ef7ab8eb3590f428c0b1ea480736ce32b01fef2a5f8daf9" } }
243-
wheels = [{ url = "https://files.pythonhosted.org/packages/27/2c/daca29684cbe9fd4bc711f8246da3c10adca1ccc4d24436b17572eb2590e/roman_numerals_py-4.1.0-py3-none-any.whl", upload-time = 2025-12-17T18:25:40Z, size = 4547, hashes = { sha256 = "553114c1167141c1283a51743759723ecd05604a1b6b507225e91dc1a6df0780" } }]
244-
245239
[[packages]]
246240
name = "snowballstemmer"
247241
version = "2.2.0"
@@ -250,9 +244,9 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/ed/dc/c02e01294f7265e
250244

251245
[[packages]]
252246
name = "sphinx"
253-
version = "8.2.3"
254-
sdist = { url = "https://files.pythonhosted.org/packages/38/ad/4360e50ed56cb483667b8e6dadf2d3fda62359593faabbe749a27c4eaca6/sphinx-8.2.3.tar.gz", upload-time = 2025-03-02T22:31:59Z, size = 8321876, hashes = { sha256 = "398ad29dee7f63a75888314e9424d40f52ce5a6a87ae88e7071e80af296ec348" } }
255-
wheels = [{ url = "https://files.pythonhosted.org/packages/31/53/136e9eca6e0b9dc0e1962e2c908fbea2e5ac000c2a2fbd9a35797958c48b/sphinx-8.2.3-py3-none-any.whl", upload-time = 2025-03-02T22:31:56Z, size = 3589741, hashes = { sha256 = "4405915165f13521d875a8c29c8970800a0141c14cc5416a38feca4ea5d9b9c3" } }]
247+
version = "9.1.1"
248+
sdist = { url = "https://files.pythonhosted.org/packages/fc/73/567727fc8c8d85bc3adc88a246e12937cfda8d565cf1d80e85bceaa61fe5/sphinx-9.1.1.tar.gz", upload-time = 2026-10-20T00:41:13Z, size = 8725638, hashes = { sha256 = "48b627f02908f22c601b3ba9c7b17265b4f315dd05c8bc64cd4da41183f44fbc" } }
249+
wheels = [{ url = "https://files.pythonhosted.org/packages/47/18/3c66ea76da7de47e716b181c35bdbfafbd5e9af0bb247b14578e9de348e9/sphinx-9.1.1-py3-none-any.whl", upload-time = 2026-10-20T00:41:11Z, size = 3923559, hashes = { sha256 = "f8b60013ce25017be41a509e5c2d265bc1918410061315c36b809c7f335646c0" } }]
256250

257251
[[packages]]
258252
name = "sphinx-linklint"

‎Doc/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# won't suddenly cause build failures. Updating the version is fine as long
88
# as no warnings are raised by doing so.
99
# Keep this version in sync with ``Doc/conf.py``.
10-
sphinx<9.0.0
10+
sphinx~=9.1.1
1111

1212
pygments>=2.21
1313

‎Doc/tools/static/search_scorer.js‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
var Scorer = {
2+
score: function (result) {
3+
let [docname, title, anchor, descr, score, filename, kind] = result;
4+
5+
// boost the score of built-in functions and types
6+
const builtinPages = [
7+
"builtins/constants",
8+
"builtins/exceptions",
9+
"builtins/functions",
10+
"builtins/stdtypes",
11+
];
12+
if (kind === "object" && builtinPages.includes(docname)) {
13+
score += 7;
14+
}
15+
16+
return score;
17+
},
18+
19+
// all values below this line are the Sphinx defaults
20+
// (see https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_search_scorer)
21+
22+
// Additive scores depending on the priority of the object
23+
// Priority is set by object domains
24+
// (see https://www.sphinx-doc.org/en/master/extdev/domainapi.html)
25+
objPrio: {
26+
0: 15,
27+
1: 5,
28+
2: -5,
29+
},
30+
objPrioDefault: 0,
31+
32+
objNameMatch: 11, // score if object's name exactly matches search query
33+
objPartialMatch: 6, // score if object's name contains search query
34+
35+
title: 15, // score if title exactly matches search query
36+
partialTitle: 7, // score if title contains search query
37+
38+
term: 5, // score if a term exactly matches search query
39+
partialTerm: 2, // score if a term contains search query
40+
};

‎Include/internal/pycore_dict.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ PyAPI_FUNC(int) _PyDict_SetItem_KnownHash_LockHeld(PyDictObject *mp, PyObject *k
170170
PyAPI_FUNC(int) _PyDict_GetItemRef_KnownHash_LockHeld(PyDictObject *op, PyObject *key, Py_hash_t hash, PyObject **result);
171171
PyAPI_FUNC(int) _PyDict_GetItemRef_KnownHash(PyDictObject *op, PyObject *key, Py_hash_t hash, PyObject **result);
172172
extern int _PyDict_GetItemRef_Unicode_LockHeld(PyDictObject *op, PyObject *key, PyObject **result);
173+
extern PyObject *_PyDict_GetItem_ExactUnicode(PyDictObject *mp, PyObject *key);
174+
extern int _PyDict_GetItemStackRef_ExactUnicode(PyDictObject *mp,
175+
PyObject *key,
176+
_PyStackRef *value_addr);
173177
PyAPI_FUNC(int) _PyObjectDict_SetItem(PyTypeObject *tp, PyObject *obj, PyObject **dictptr, PyObject *name, PyObject *value);
174178

175179
extern int _PyDict_Pop_KnownHash(

‎Lib/asyncio/base_tasks.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ def _task_get_stack(task, limit):
4242
elif hasattr(task._coro, 'ag_frame'):
4343
# case 3: async generators
4444
f = task._coro.ag_frame
45+
elif not task.done() and hasattr(task._coro, 'aga_gen'):
46+
# case 4: async generator's asend/athrow/aclose
47+
f = task._coro.aga_gen.ag_frame
4548
else:
46-
# case 4: unknown objects
49+
# case 5: unknown objects
4750
f = None
4851
if f is not None:
4952
while f is not None:

‎Lib/asyncio/sslproto.py‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ def close(self):
114114
if not self._closed:
115115
self._closed = True
116116
self._ssl_protocol._start_shutdown()
117-
else:
118-
self._ssl_protocol = None
119117

120118
def __del__(self, _warnings=warnings):
121119
if not self._closed:
@@ -412,12 +410,14 @@ def connection_lost(self, exc):
412410
# The app protocol gets connection_lost() only if it got
413411
# connection_made(). After start_tls() that is already the case
414412
# while the handshake is in progress.
413+
app_notified = False
415414
if (
416415
self._app_state == AppProtocolState.STATE_CON_MADE or
417416
self._app_state == AppProtocolState.STATE_EOF
418417
):
419418
self._app_state = AppProtocolState.STATE_CON_LOST
420419
self._loop.call_soon(self._app_protocol.connection_lost, exc)
420+
app_notified = True
421421
self._set_state(SSLProtocolState.UNWRAPPED)
422422
self._transport = None
423423
self._app_transport = None
@@ -430,6 +430,21 @@ def connection_lost(self, exc):
430430
if self._handshake_timeout_handle:
431431
self._handshake_timeout_handle.cancel()
432432
self._handshake_timeout_handle = None
433+
if app_notified:
434+
# After the app protocol's connection_lost() (scheduled above),
435+
# so that it can still read the TLS extra info.
436+
self._loop.call_soon(self._release_tls_state)
437+
else:
438+
self._release_tls_state()
439+
440+
def _release_tls_state(self):
441+
# The connection is gone: drop everything that refers to the
442+
# SSLContext, so that an application holding the transport does
443+
# not keep the context alive.
444+
self._sslobj = None
445+
self._sslcontext = None
446+
self._extra.pop('sslcontext', None)
447+
self._extra.pop('ssl_object', None)
433448

434449
def get_buffer(self, n):
435450
want = n

‎Lib/asyncio/tools.py‎

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,22 @@ def _find_cycles(graph):
128128
def dfs(v):
129129
color[v] = GREY
130130
path.append(v)
131-
for w in graph.get(v, ()):
132-
if color[w] == WHITE:
133-
dfs(w)
134-
elif color[w] == GREY: # back-edge → cycle!
135-
i = path.index(w)
136-
cycles.append(path[i:] + [w]) # make a copy
137-
color[v] = BLACK
138-
path.pop()
131+
stack = [(v, iter(graph.get(v, ())))]
132+
while stack:
133+
node, children = stack[-1]
134+
for w in children:
135+
if color[w] == WHITE:
136+
color[w] = GREY
137+
path.append(w)
138+
stack.append((w, iter(graph.get(w, ()))))
139+
break
140+
elif color[w] == GREY: # back-edge → cycle!
141+
i = path.index(w)
142+
cycles.append(path[i:] + [w]) # make a copy
143+
else:
144+
color[node] = BLACK
145+
path.pop()
146+
stack.pop()
139147

140148
for v in list(graph):
141149
if color[v] == WHITE:
@@ -167,14 +175,16 @@ def pretty(node):
167175
flag = task_emoji if node[0] == NodeType.TASK else cor_emoji
168176
return f"{flag} {labels[node]}"
169177

170-
def render(node, prefix="", last=True, buf=None):
171-
if buf is None:
172-
buf = []
173-
buf.append(f"{prefix}{'└── ' if last else '├── '}{pretty(node)}")
174-
new_pref = prefix + (" " if last else "│ ")
175-
kids = children.get(node, [])
176-
for i, kid in enumerate(kids):
177-
render(kid, new_pref, i == len(kids) - 1, buf)
178+
def render(root):
179+
buf = []
180+
stack = [(root, "", True)]
181+
while stack:
182+
node, prefix, last = stack.pop()
183+
buf.append(f"{prefix}{'└── ' if last else '├── '}{pretty(node)}")
184+
new_pref = prefix + (" " if last else "│ ")
185+
kids = children.get(node, [])
186+
for i in range(len(kids) - 1, -1, -1):
187+
stack.append((kids[i], new_pref, i == len(kids) - 1))
178188
return buf
179189

180190
return [render(root) for root in _roots(labels, children)]

0 commit comments

Comments
 (0)