Skip to content

Commit fb0f421

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.7+ stable branch (2026-09-29)
Summary: Imported python/cpython `3.14.7+` from upstream rev [`6daaf3b`](https://www.github.com/python/cpython/commit/6daaf3b2a62baf2fb520cb6aeeb493a171669a03) (committed 2026-09-29 02:52:24+00:00). # Commit Info - Base: (`3.14.7+`) - [`24ddd48`](https://www.github.com/python/cpython/commit/24ddd48a2a89e9f3de1245db9b86b6a80ae2d0d2) (commit date: 2026-09-28 00:52:58+00:00) - Imported: (`3.14.7+`) - [`6daaf3b`](https://www.github.com/python/cpython/commit/6daaf3b2a62baf2fb520cb6aeeb493a171669a03) (commit date: 2026-09-29 02:52:24+00:00) # Noteworthy file changes - Low-signal files (2 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GB0ChTBCuzFCA00QALZRzuM8kgsnbr0LAAAz Reviewed By: itamaro Differential Revision: D122330175 fbshipit-source-id: 3e4da5d16e3eab910865d53914e523f9a8dbfe86
1 parent 38a69a4 commit fb0f421

11 files changed

Lines changed: 690 additions & 751 deletions

File tree

‎Doc/library/turtle.rst‎

Lines changed: 229 additions & 362 deletions
Large diffs are not rendered by default.

‎Doc/using/configure.rst‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ Dependencies to build optional modules are:
9494
-
9595
- :mod:`curses`
9696
* - `OpenSSL <https://openssl-library.org/>`_
97-
- | 3.0.18 recommended
98-
| (1.1.1 minimum)
97+
- [6]_
9998
- :mod:`ssl`, :mod:`hashlib` [5]_
10099
* - `SQLite <https://sqlite.org/>`_
101100
- 3.15.2
@@ -124,6 +123,14 @@ Dependencies to build optional modules are:
124123
.. [5] If OpenSSL is not available, the :mod:`hashlib` module will use
125124
bundled implementations of several hash functions.
126125
See :option:`--with-builtin-hashlib-hashes` for *forcing* usage of OpenSSL.
126+
.. [6] OpenSSL 1.1.1 is the minimum possible version to build against,
127+
but the series is end-of-life and no longer receives public security
128+
fixes. Use the latest patch release of a currently supported LTS
129+
release series (see the `OpenSSL Roadmap
130+
<https://openssl-library.org/roadmap/index.html>`__), or the package
131+
provided by your operating system if available. Other libraries that
132+
offer an API compatible with OpenSSL 1.1.1 or later may work, but are
133+
not officially supported.
127134
128135
Note that the table does not include all optional modules; in particular,
129136
platform-specific modules like :mod:`winreg` are not listed here.

‎Include/internal/pycore_pystate.h‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,23 @@ extern void _PyThreadState_Detach(PyThreadState *tstate);
152152
// to the "detached" state.
153153
extern void _PyThreadState_Suspend(PyThreadState *tstate);
154154

155+
#ifdef Py_GIL_DISABLED
156+
// Try to atomically transition a *different* thread's state from "detached"
157+
// to "suspended". On success, the target thread cannot attach until
158+
// _PyThreadState_ResumeDetached() is called, and the caller may safely
159+
// perform operations that are normally only permitted for the owning thread
160+
// (such as merging the biased reference counts of objects it owns).
161+
//
162+
// The caller must not run arbitrary Python code, allocate GC objects, or
163+
// stop the world while holding the thread in the suspended state.
164+
// Returns 1 on success, 0 if the thread was not in the "detached" state.
165+
extern int _PyThreadState_TrySuspendDetached(PyThreadState *tstate);
166+
167+
// Undo a successful _PyThreadState_TrySuspendDetached(): switch the thread
168+
// back to "detached" and wake it if it is waiting to attach.
169+
extern void _PyThreadState_ResumeDetached(PyThreadState *tstate);
170+
#endif
171+
155172
// Mark the thread state as "shutting down". This is used during interpreter
156173
// and runtime finalization. The thread may no longer attach to the
157174
// interpreter and will instead block via _PyThreadState_HangThread().

‎Lib/test/test_free_threading/test_gc.py‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
from threading import Thread
55
from unittest import TestCase
66
import gc
7+
import weakref
78

9+
from test import support
810
from test.support import threading_helper
911

1012

@@ -94,6 +96,39 @@ def evil():
9496
thread.start()
9597
thread.join()
9698

99+
def test_merge_brc_queue_of_detached_thread(self):
100+
# GH-157838: objects queued for merging by a thread that is detached
101+
# (blocked in a lock acquire, sleep, etc.) are merged and freed on its
102+
# behalf instead of staying alive until it runs Python code again.
103+
lock = threading.Lock()
104+
lock.acquire()
105+
ready = threading.Event()
106+
objs = []
107+
108+
def worker():
109+
# Objects owned by this thread; only the list holds a reference.
110+
objs.extend(MyObj() for _ in range(100))
111+
ready.set()
112+
lock.acquire() # block while detached
113+
114+
thread = Thread(target=worker)
115+
thread.start()
116+
try:
117+
ready.wait()
118+
# The worker may not have detached yet when the first objects
119+
# are dropped; keep trying until one is freed immediately.
120+
for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):
121+
obj = objs.pop()
122+
wr = weakref.ref(obj)
123+
del obj
124+
if wr() is None:
125+
break
126+
else:
127+
self.fail("object not freed while owning thread was detached")
128+
finally:
129+
lock.release()
130+
thread.join()
131+
97132
def test_set_threshold(self):
98133
# GH-148613: Setting the GC threshold from another thread could cause a
99134
# race between the `gc_should_collect` and `gc_set_threshold` functions.

‎Lib/test/test_multibytecodec.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,15 @@ def test_iso2022(self):
265265
self.assertRaises(UnicodeDecodeError, decoder.decode, b'', True)
266266
self.assertEqual(decoder.decode(b'B@$'), '\u4e16')
267267

268+
def test_hz_keep_buffer(self):
269+
# A trailing '~' shouldn't read past the end of the input.
270+
decoder = codecs.getincrementaldecoder('hz')()
271+
self.assertEqual(decoder.decode(b'~'), '')
272+
self.assertRaises(UnicodeDecodeError, decoder.decode, b'', True)
273+
self.assertEqual(decoder.decode(b'~'), '~')
274+
self.assertEqual(decoder.decode(b'~'), '')
275+
self.assertEqual(decoder.decode(b'\n', True), '')
276+
268277
def test_decode_unicode(self):
269278
# Trying to decode a unicode string should raise a TypeError
270279
for enc in ALL_CJKENCODINGS:

0 commit comments

Comments
 (0)