Skip to content

Commit d8921ac

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython 3.15 branch from GitHub (2026-06-26)
Summary: Imported python/cpython `3.15.0b3+dev` from upstream rev [`0290166`](https://www.github.com/python/cpython/commit/029016654ec08142f59d4f46113b3c1ec0830387) (committed 2026-06-26 23:31:46+00:00). # Commit Info - Base: (`3.15.0b3+dev`) - [`b7a4137`](https://www.github.com/python/cpython/commit/b7a41375ff9b247f53cc4264d4fe8a9fd45d8f7d) (commit date: 2026-06-26 03:49:15+00:00) - Imported: (`3.15.0b3+dev`) - [`0290166`](https://www.github.com/python/cpython/commit/029016654ec08142f59d4f46113b3c1ec0830387) (commit date: 2026-06-26 23:31:46+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=GDiXEyWDlCiYGXIDAJ-nIgZUa3Q6br0LAAAz Differential Revision: D109921163 fbshipit-source-id: d2453dc519cdbda741f52ca335f3433ee32c8237
1 parent d9e379c commit d8921ac

34 files changed

Lines changed: 347 additions & 142 deletions

Doc/deprecations/soft-deprecations.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ There are no plans to remove :term:`soft deprecated` APIs.
1919

2020
(Contributed by Gregory P. Smith in :gh:`86519` and
2121
Hugo van Kemenade in :gh:`148100`.)
22+
23+
* Using ``'F'`` and ``'D'`` format type codes of the :mod:`struct` module
24+
now are :term:`soft deprecated` in favor of two-letter forms ``'Zf'``
25+
and ``'Zd'``.
26+
(Contributed by Sergey B Kirpichev in :gh:`121249`.)

Doc/library/struct.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,6 @@ platform-dependent.
260260
+--------+--------------------------+--------------------+----------------+------------+
261261
| ``d`` | :c:expr:`double` | float | 8 | \(4) |
262262
+--------+--------------------------+--------------------+----------------+------------+
263-
| ``F`` | :c:expr:`float complex` | complex | 8 | \(10) |
264-
+--------+--------------------------+--------------------+----------------+------------+
265-
| ``D`` | :c:expr:`double complex` | complex | 16 | \(10) |
266-
+--------+--------------------------+--------------------+----------------+------------+
267263
| ``Zf`` | :c:expr:`float complex` | complex | 8 | \(10) |
268264
+--------+--------------------------+--------------------+----------------+------------+
269265
| ``Zd`` | :c:expr:`double complex` | complex | 16 | \(10) |
@@ -286,6 +282,7 @@ platform-dependent.
286282

287283
.. versionchanged:: 3.15
288284
Added support for the ``'Zf'`` and ``'Zd'`` formats.
285+
``'F'`` and ``'D'`` formats are :term:`soft deprecated`.
289286

290287
.. seealso::
291288

@@ -376,13 +373,15 @@ Notes:
376373
are accepted.
377374

378375
(10)
379-
For the ``'F'`` and ``'D'`` format characters, the packed representation uses
376+
For the ``'Zf'`` and ``'Zd'`` type codes, the packed representation uses
380377
the IEEE 754 binary32 and binary64 format for components of the complex
381378
number, regardless of the floating-point format used by the platform.
382-
Note that complex types (``F``/``Zf`` and ``D``/``Zd``) are available unconditionally,
379+
Note that complex types are available unconditionally,
383380
despite complex types being an optional feature in C.
384381
As specified in the C11 standard, each complex type is represented by a
385382
two-element C array containing, respectively, the real and imaginary parts.
383+
The ``'F'`` and ``'D'`` (for ``'Zf'`` and ``'Zd'``, respectively) format
384+
characters are supported for compatibility.
386385

387386

388387
A format character may be preceded by an integral repeat count. For example,

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,11 @@ New deprecations
22802280

22812281
(Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.)
22822282

2283+
* Using ``'F'`` and ``'D'`` type codes now are :term:`soft deprecated`
2284+
in favor of two-letter forms ``'Zf'`` and ``'Zd'``.
2285+
(Contributed by Sergey B Kirpichev in :gh:`121249`.)
2286+
2287+
22832288
* :mod:`typing`:
22842289

22852290
* The following statements now cause ``DeprecationWarning``\ s to be emitted

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",
@@ -1314,6 +1314,22 @@ def wrapper(self):
13141314
return wrapper
13151315
return decorator
13161316

1317+
def nomemtest(f):
1318+
"""Check that we can use this test with `_testcapi.set_nomemory`."""
1319+
from .import_helper import import_module
1320+
1321+
@functools.wraps(f)
1322+
def internal(*args, **kwargs):
1323+
import_module('_testcapi')
1324+
return f(*args, **kwargs)
1325+
1326+
return unittest.skipIf(
1327+
# Python built with Py_TRACE_REFS fail with a fatal error in
1328+
# _PyRefchain_Trace() on memory allocation error.
1329+
Py_TRACE_REFS,
1330+
'cannot test Py_TRACE_REFS build',
1331+
)(cpython_only(internal))
1332+
13171333
def bigaddrspacetest(f):
13181334
"""Decorator for tests that fill the address space."""
13191335
def wrapper(self):

Lib/test/test_atexit.py

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

194-
# Python built with Py_TRACE_REFS fail with a fatal error in
195-
# _PyRefchain_Trace() on memory allocation error.
196-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
194+
@support.nomemtest
197195
def test_atexit_with_low_memory(self):
198196
# gh-140080: Test that setting low memory after registering an atexit
199197
# 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:
@@ -1013,11 +1012,8 @@ class C:
10131012
C.a = X()
10141013
C.a = X()
10151014

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

Lib/test/test_dtrace.py

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

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

1822

1923
def abspath(filename):
@@ -397,12 +401,9 @@ class BPFTraceOptimizedTests(TraceTests, unittest.TestCase):
397401
class CheckDtraceProbes(unittest.TestCase):
398402
@classmethod
399403
def setUpClass(cls):
400-
if sysconfig.get_config_var('WITH_DTRACE'):
401-
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
402-
if support.verbose:
403-
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
404-
else:
405-
raise unittest.SkipTest("CPython must be configured with the --with-dtrace option.")
404+
readelf_major_version, readelf_minor_version = cls.get_readelf_version()
405+
if support.verbose:
406+
print(f"readelf version: {readelf_major_version}.{readelf_minor_version}")
406407

407408

408409
@staticmethod

Lib/test/test_exceptions.py

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

15851585

1586-
@cpython_only
1587-
# Python built with Py_TRACE_REFS fail with a fatal error in
1588-
# _PyRefchain_Trace() on memory allocation error.
1589-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
1590-
@unittest.skipIf(_testcapi is None, "requires _testcapi")
1586+
@support.nomemtest
15911587
def test_recursion_normalizing_with_no_memory(self):
15921588
# Issue #30697. Test that in the abort that occurs when there is no
15931589
# memory left and the size of the Python frames stack is greater than
@@ -1774,11 +1770,7 @@ def test_unhandled(self):
17741770
self.assertIn("test message", report)
17751771
self.assertEndsWith(report, "\n")
17761772

1777-
@cpython_only
1778-
# Python built with Py_TRACE_REFS fail with a fatal error in
1779-
# _PyRefchain_Trace() on memory allocation error.
1780-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
1781-
@unittest.skipIf(_testcapi is None, "requires _testcapi")
1773+
@support.nomemtest
17821774
def test_memory_error_in_PyErr_PrintEx(self):
17831775
code = """if 1:
17841776
import _testcapi
@@ -1936,12 +1928,8 @@ def test_keyerror_context(self):
19361928
exc2 = None
19371929

19381930

1939-
@cpython_only
1940-
# Python built with Py_TRACE_REFS fail with a fatal error in
1941-
# _PyRefchain_Trace() on memory allocation error.
1942-
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')
1931+
@support.nomemtest
19431932
def test_exec_set_nomemory_hang(self):
1944-
import_module("_testcapi")
19451933
# gh-134163: A MemoryError inside code that was wrapped by a try/except
19461934
# block would lead to an infinite loop.
19471935

0 commit comments

Comments
 (0)