Skip to content

Commit f434f46

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.6+ stable branch (2026-06-26)
Summary: Imported python/cpython `3.14.6+` from upstream rev [`069c9c0`](https://www.github.com/python/cpython/commit/069c9c0af51839dfd17663d5834f492570cfee50) (committed 2026-06-26 23:28:56+00:00). # Commit Info - Base: (`3.14.6+`) - [`93ade5e`](https://www.github.com/python/cpython/commit/93ade5e38660f811b50d54e56c606076878f164c) (commit date: 2026-06-26 03:00:03+00:00) - Imported: (`3.14.6+`) - [`069c9c0`](https://www.github.com/python/cpython/commit/069c9c0af51839dfd17663d5834f492570cfee50) (commit date: 2026-06-26 23:28:56+00:00) # Noteworthy file changes - Low-signal files (9 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GHGsEyZDg4R2jY0FAAnqYU2FLj9Rbr0LAAAz Reviewed By: ambv Differential Revision: D109935459 fbshipit-source-id: 9e39a2b17b3343b0896ec5ef070ee8763fdd74b4
1 parent 401c796 commit f434f46

30 files changed

Lines changed: 260 additions & 99 deletions

Lib/idlelib/idle_test/htest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@
216216
'file': 'browser',
217217
'kwds': {},
218218
'msg': textwrap.dedent("""
219-
"Inspect names of module, class(with superclass if applicable),
220-
"methods and functions. Toggle nested items. Double clicking
221-
"on items prints a traceback for an exception that is ignored.""")
219+
Inspect names of module, class(with superclass if applicable),
220+
methods and functions. Toggle nested items. Double clicking
221+
on items prints a traceback for an exception that is ignored.""")
222222
}
223223

224224
_multistatus_bar_spec = {

Lib/test/support/__init__.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"requires_gil_enabled", "requires_linux_version", "requires_mac_ver",
3636
"check_syntax_error",
3737
"requires_gzip", "requires_bz2", "requires_lzma", "requires_zstd",
38-
"bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute",
38+
"bigmemtest", "nomemtest", "bigaddrspacetest", "cpython_only", "get_attribute",
3939
"requires_IEEE_754", "requires_zlib",
4040
"has_fork_support", "requires_fork",
4141
"has_subprocess_support", "requires_subprocess",
@@ -1226,6 +1226,22 @@ def wrapper(self):
12261226
return wrapper
12271227
return decorator
12281228

1229+
def nomemtest(f):
1230+
"""Check that we can use this test with `_testcapi.set_nomemory`."""
1231+
from .import_helper import import_module
1232+
1233+
@functools.wraps(f)
1234+
def internal(*args, **kwargs):
1235+
import_module('_testcapi')
1236+
return f(*args, **kwargs)
1237+
1238+
return unittest.skipIf(
1239+
# Python built with Py_TRACE_REFS fail with a fatal error in
1240+
# _PyRefchain_Trace() on memory allocation error.
1241+
Py_TRACE_REFS,
1242+
'cannot test Py_TRACE_REFS build',
1243+
)(cpython_only(internal))
1244+
12291245
def bigaddrspacetest(f):
12301246
"""Decorator for tests that fill the address space."""
12311247
def wrapper(self):

Lib/test/test_atexit.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ def callback():
135135
self.assertEqual(os.read(r, len(expected)), expected)
136136
os.close(r)
137137

138-
# Python built with Py_TRACE_REFS fail with a fatal error in
139-
# _PyRefchain_Trace() on memory allocation error.
140-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
138+
@support.nomemtest
141139
def test_atexit_with_low_memory(self):
142140
# gh-140080: Test that setting low memory after registering an atexit
143141
# callback doesn't cause an infinite loop during finalization.

Lib/test/test_capi/test_mem.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ def test_pyobject_forbidden_bytes_is_freed(self):
117117
def test_pyobject_freed_is_freed(self):
118118
self.check_pyobject_is_freed('check_pyobject_freed_is_freed')
119119

120-
# Python built with Py_TRACE_REFS fail with a fatal error in
121-
# _PyRefchain_Trace() on memory allocation error.
122-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
120+
@support.nomemtest
123121
def test_set_nomemory(self):
124122
code = """if 1:
125123
import _testcapi

Lib/test/test_class.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ def __delattr__(self, *args):
449449

450450
def testHasAttrString(self):
451451
import sys
452-
from test.support import import_helper
453452
_testlimitedcapi = import_helper.import_module('_testlimitedcapi')
454453

455454
class A:
@@ -1012,11 +1011,8 @@ class C:
10121011
C.a = X()
10131012
C.a = X()
10141013

1015-
@cpython_only
1014+
@support.nomemtest
10161015
def test_detach_materialized_dict_no_memory(self):
1017-
# Skip test if _testcapi is not available:
1018-
import_helper.import_module('_testcapi')
1019-
10201016
code = """if 1:
10211017
import test.support
10221018
import _testcapi

Lib/test/test_dtrace.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
if not support.has_subprocess_support:
1515
raise unittest.SkipTest("test module requires subprocess")
16+
if not sysconfig.get_config_var('WITH_DTRACE'):
17+
raise unittest.SkipTest(
18+
"CPython must be configured with the --with-dtrace option."
19+
)
1620

1721

1822
def abspath(filename):
@@ -178,12 +182,9 @@ class SystemTapOptimizedTests(TraceTests, unittest.TestCase):
178182
class CheckDtraceProbes(unittest.TestCase):
179183
@classmethod
180184
def setUpClass(cls):
181-
if sysconfig.get_config_var('WITH_DTRACE'):
182-
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
183-
if support.verbose:
184-
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
185-
else:
186-
raise unittest.SkipTest("CPython must be configured with the --with-dtrace option.")
185+
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
186+
if support.verbose:
187+
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
187188

188189

189190
@staticmethod

Lib/test/test_exceptions.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,11 +1575,7 @@ def recurse_in_body_and_except():
15751575
sys.setrecursionlimit(recursionlimit)
15761576

15771577

1578-
@cpython_only
1579-
# Python built with Py_TRACE_REFS fail with a fatal error in
1580-
# _PyRefchain_Trace() on memory allocation error.
1581-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
1582-
@unittest.skipIf(_testcapi is None, "requires _testcapi")
1578+
@support.nomemtest
15831579
def test_recursion_normalizing_with_no_memory(self):
15841580
# Issue #30697. Test that in the abort that occurs when there is no
15851581
# memory left and the size of the Python frames stack is greater than
@@ -1766,11 +1762,7 @@ def test_unhandled(self):
17661762
self.assertIn("test message", report)
17671763
self.assertEndsWith(report, "\n")
17681764

1769-
@cpython_only
1770-
# Python built with Py_TRACE_REFS fail with a fatal error in
1771-
# _PyRefchain_Trace() on memory allocation error.
1772-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
1773-
@unittest.skipIf(_testcapi is None, "requires _testcapi")
1765+
@support.nomemtest
17741766
def test_memory_error_in_PyErr_PrintEx(self):
17751767
code = """if 1:
17761768
import _testcapi
@@ -1928,12 +1920,8 @@ def test_keyerror_context(self):
19281920
exc2 = None
19291921

19301922

1931-
@cpython_only
1932-
# Python built with Py_TRACE_REFS fail with a fatal error in
1933-
# _PyRefchain_Trace() on memory allocation error.
1934-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
1923+
@support.nomemtest
19351924
def test_exec_set_nomemory_hang(self):
1936-
import_module("_testcapi")
19371925
# gh-134163: A MemoryError inside code that was wrapped by a try/except
19381926
# block would lead to an infinite loop.
19391927

Lib/test/test_interpreters/test_stress.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from test.support import import_helper
66
from test.support import threading_helper
77
# Raise SkipTest if subinterpreters not supported.
8-
import_helper.import_module('_interpreters')
8+
_interpreters = import_helper.import_module('_interpreters')
99
from concurrent import interpreters
1010
from concurrent.interpreters import InterpreterError
1111
from .utils import TestBase
@@ -75,12 +75,13 @@ def run():
7575
start.set()
7676
support.gc_collect()
7777

78+
@support.nomemtest
7879
def test_create_interpreter_no_memory(self):
79-
import _interpreters
80-
_testcapi = import_helper.import_module("_testcapi")
80+
import _testcapi
8181

82-
with self.assertRaises(InterpreterError):
83-
_testcapi.set_nomemory(0, 1)
82+
assertion = self.assertRaises(InterpreterError)
83+
_testcapi.set_nomemory(0, 1)
84+
with assertion:
8485
_interpreters.create()
8586

8687

Lib/test/test_json/test_fail.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ def test_truncated_input(self):
144144
('"', 'Unterminated string starting at', 0),
145145
('"spam', 'Unterminated string starting at', 0),
146146
]
147+
# A complete \uXXXX escape at end of input leaves it unterminated.
148+
test_cases += [
149+
(r'"\u0041', 'Unterminated string starting at', 0),
150+
(r'"\ud834', 'Unterminated string starting at', 0),
151+
(r'"\ud834\udd1e', 'Unterminated string starting at', 0),
152+
(r'{"a": "\u0041', 'Unterminated string starting at', 6),
153+
]
147154
for data, msg, idx in test_cases:
148155
with self.assertRaises(self.JSONDecodeError) as cm:
149156
self.loads(data)

Lib/test/test_json/test_scanstring.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ def test_bad_escapes(self):
137137
'"\\ud834\\u-123"',
138138
'"\\ud834\\u+123"',
139139
'"\\ud834\\u1_23"',
140+
# Truncated or non-hex \uXXXX escape at end of input.
141+
'"\\u004',
142+
'"\\uXYZW',
140143
]
141144
for s in bad_escapes:
142145
with self.assertRaises(self.JSONDecodeError, msg=s):

0 commit comments

Comments
 (0)