Skip to content

Commit 75ed362

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.6+ stable branch (2026-07-23)
Summary: Imported python/cpython `3.14.6+` from upstream rev [`37a5c69`](https://www.github.com/python/cpython/commit/37a5c690d033099276c8a264c1a660819863bd68) (committed 2026-07-23 08:21:52+00:00). # Commit Info - Base: (`3.14.6+`) - [`8aa1b8b`](https://www.github.com/python/cpython/commit/8aa1b8b42ee47f252641d2a0d232bc94afd501e2) (commit date: 2026-07-22 04:43:51+00:00) - Imported: (`3.14.6+`) - [`37a5c69`](https://www.github.com/python/cpython/commit/37a5c690d033099276c8a264c1a660819863bd68) (commit date: 2026-07-23 08:21:52+00:00) # Noteworthy file changes - Test files (1 added) - Low-signal files (2 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GGRD7iy3TFP_2QMJAC_hjsD5ZsxDbr0LAAAz Reviewed By: itamaro Differential Revision: D113545807 fbshipit-source-id: e0145073104475db8f1675f3184be206ebfb1837
1 parent 6b2b68a commit 75ed362

20 files changed

Lines changed: 451 additions & 48 deletions

File tree

Doc/library/lzma.rst

Lines changed: 111 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -155,35 +155,14 @@ Compressing and decompressing data in memory
155155
:func:`compress`.
156156

157157
The *format* argument specifies what container format should be used.
158-
Possible values are:
159-
160-
* :const:`FORMAT_XZ`: The ``.xz`` container format.
161-
This is the default format.
162-
163-
* :const:`FORMAT_ALONE`: The legacy ``.lzma`` container format.
164-
This format is more limited than ``.xz`` -- it does not support integrity
165-
checks or multiple filters.
166-
167-
* :const:`FORMAT_RAW`: A raw data stream, not using any container format.
168-
This format specifier does not support integrity checks, and requires that
169-
you always specify a custom filter chain (for both compression and
170-
decompression). Additionally, data compressed in this manner cannot be
171-
decompressed using :const:`FORMAT_AUTO` (see :class:`LZMADecompressor`).
158+
Possible values are :const:`FORMAT_XZ` (the default),
159+
:const:`FORMAT_ALONE` and :const:`FORMAT_RAW`.
172160

173161
The *check* argument specifies the type of integrity check to include in the
174162
compressed data. This check is used when decompressing, to ensure that the
175-
data has not been corrupted. Possible values are:
176-
177-
* :const:`CHECK_NONE`: No integrity check.
178-
This is the default (and the only acceptable value) for
179-
:const:`FORMAT_ALONE` and :const:`FORMAT_RAW`.
180-
181-
* :const:`CHECK_CRC32`: 32-bit Cyclic Redundancy Check.
182-
183-
* :const:`CHECK_CRC64`: 64-bit Cyclic Redundancy Check.
184-
This is the default for :const:`FORMAT_XZ`.
185-
186-
* :const:`CHECK_SHA256`: 256-bit Secure Hash Algorithm.
163+
data has not been corrupted. Possible values are :const:`CHECK_NONE`,
164+
:const:`CHECK_CRC32`, :const:`CHECK_CRC64` (the default for
165+
:const:`FORMAT_XZ`) and :const:`CHECK_SHA256`.
187166

188167
If the specified check is not supported, an :class:`LZMAError` is raised.
189168

@@ -359,12 +338,12 @@ options. Valid filter IDs are as follows:
359338

360339
* Branch-Call-Jump (BCJ) filters:
361340

362-
* :const:`FILTER_X86`
363-
* :const:`FILTER_IA64`
364-
* :const:`FILTER_ARM`
365-
* :const:`FILTER_ARMTHUMB`
366-
* :const:`FILTER_POWERPC`
367-
* :const:`FILTER_SPARC`
341+
* :const:`!FILTER_X86`
342+
* :const:`!FILTER_IA64`
343+
* :const:`!FILTER_ARM`
344+
* :const:`!FILTER_ARMTHUMB`
345+
* :const:`!FILTER_POWERPC`
346+
* :const:`!FILTER_SPARC`
368347

369348
A filter chain can consist of up to 4 filters, and cannot be empty. The last
370349
filter in the chain must be a compression filter, and any other filters must be
@@ -401,6 +380,106 @@ These filters support one option, ``start_offset``. This specifies the address
401380
that should be mapped to the beginning of the input data. The default is 0.
402381

403382

383+
Constants
384+
---------
385+
386+
The following module-level constants are provided for use as the *format*,
387+
*check*, *preset* and *filters* arguments of the classes and functions above.
388+
389+
Container formats:
390+
391+
.. data:: FORMAT_XZ
392+
393+
The ``.xz`` container format.
394+
395+
.. data:: FORMAT_ALONE
396+
397+
The legacy ``.lzma`` container format. This format is more limited than
398+
``.xz`` -- it does not support integrity checks or multiple filters.
399+
400+
.. data:: FORMAT_RAW
401+
402+
A raw data stream, not using any container format. This format specifier
403+
does not support integrity checks, and requires that you always specify a
404+
custom filter chain (for both compression and decompression). Additionally,
405+
data compressed in this manner cannot be decompressed using
406+
:const:`FORMAT_AUTO`.
407+
408+
.. data:: FORMAT_AUTO
409+
410+
Used for decompression only. The container format is detected
411+
automatically, so that both ``.xz`` and ``.lzma`` files can be decompressed.
412+
413+
Integrity checks:
414+
415+
.. data:: CHECK_NONE
416+
417+
No integrity check. This is the default (and the only acceptable value) for
418+
:const:`FORMAT_ALONE` and :const:`FORMAT_RAW`.
419+
420+
.. data:: CHECK_CRC32
421+
422+
A 32-bit Cyclic Redundancy Check.
423+
424+
.. data:: CHECK_CRC64
425+
426+
A 64-bit Cyclic Redundancy Check. This is the default for
427+
:const:`FORMAT_XZ`.
428+
429+
.. data:: CHECK_SHA256
430+
431+
A 256-bit Secure Hash Algorithm.
432+
433+
.. data:: CHECK_UNKNOWN
434+
435+
The integrity check used by a stream could not yet be determined. This may
436+
be the value of the :attr:`LZMADecompressor.check` attribute until enough of
437+
the input has been decoded.
438+
439+
.. data:: CHECK_ID_MAX
440+
441+
The largest supported integrity-check ID.
442+
443+
Compression presets:
444+
445+
.. data:: PRESET_DEFAULT
446+
447+
The default compression preset, equivalent to preset level ``6``.
448+
449+
.. data:: PRESET_EXTREME
450+
451+
A flag that may be bitwise OR-ed with a preset level (``0`` to ``9``) to
452+
select a slower but more thorough variant of that preset.
453+
454+
Filter IDs and options:
455+
456+
.. data:: FILTER_LZMA1
457+
FILTER_LZMA2
458+
459+
The LZMA1 and LZMA2 compression filters. :const:`FILTER_LZMA1` is for use
460+
with :const:`FORMAT_ALONE`, while :const:`FILTER_LZMA2` is for use with
461+
:const:`FORMAT_XZ` and :const:`FORMAT_RAW`.
462+
463+
.. data:: FILTER_DELTA
464+
465+
The delta filter.
466+
467+
.. data:: MODE_FAST
468+
MODE_NORMAL
469+
470+
Compression modes that may be used as the ``mode`` option of a filter
471+
specifier (see :ref:`filter-chain-specs`).
472+
473+
.. data:: MF_HC3
474+
MF_HC4
475+
MF_BT2
476+
MF_BT3
477+
MF_BT4
478+
479+
Match finders that may be used as the ``mf`` option of a filter specifier
480+
(see :ref:`filter-chain-specs`).
481+
482+
404483
Examples
405484
--------
406485

Doc/library/warnings.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ Available Functions
551551
and calls to :func:`simplefilter`.
552552

553553

554-
.. decorator:: deprecated(msg, *, category=DeprecationWarning, stacklevel=1)
554+
.. decorator:: deprecated(message, /, *, category=DeprecationWarning, stacklevel=1)
555555

556556
Decorator to indicate that a class, function or overload is deprecated.
557557

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Doc/library/email.parser.rst
1414
Doc/library/importlib.rst
1515
Doc/library/logging.config.rst
1616
Doc/library/logging.handlers.rst
17-
Doc/library/lzma.rst
1817
Doc/library/mmap.rst
1918
Doc/library/multiprocessing.rst
2019
Doc/library/optparse.rst

Lib/test/test_capi/test_mem.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ def check(self, code):
2424
out = assert_python_failure(
2525
'-c', code,
2626
PYTHONMALLOC=self.PYTHONMALLOC,
27-
# FreeBSD: instruct jemalloc to not fill freed() memory
28-
# with junk byte 0x5a, see JEMALLOC(3)
27+
# Instruct the system allocator to not fill freed() memory
28+
# with junk bytes:
29+
# FreeBSD: jemalloc, see JEMALLOC(3).
2930
MALLOC_CONF="junk:false",
31+
# OpenBSD: see MALLOC.CONF(5).
32+
MALLOC_OPTIONS="j",
3033
)
3134
stderr = out.err
3235
return stderr.decode('ascii', 'replace')
@@ -102,7 +105,9 @@ def check_pyobject_is_freed(self, func_name):
102105
assert_python_ok(
103106
'-c', code,
104107
PYTHONMALLOC=self.PYTHONMALLOC,
108+
# See the comment in check() above.
105109
MALLOC_CONF="junk:false",
110+
MALLOC_OPTIONS="j",
106111
)
107112

108113
def test_pyobject_null_is_freed(self):

Lib/test/test_concurrent_futures/test_init.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import contextlib
22
import logging
3+
import multiprocessing
34
import queue
45
import time
56
import unittest
@@ -144,6 +145,8 @@ def test_spawn(self):
144145
self._test(ProcessPoolSpawnFailingInitializerTest)
145146

146147
@support.skip_if_sanitizer("TSAN doesn't support threads after fork", thread=True)
148+
@unittest.skipUnless("forkserver" in multiprocessing.get_all_start_methods(),
149+
"forkserver start method is not available")
147150
def test_forkserver(self):
148151
self._test(ProcessPoolForkserverFailingInitializerTest)
149152

Lib/test/test_concurrent_futures/util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ def get_context(self):
138138
self.skipTest("require unix system")
139139
if support.check_sanitizer(thread=True):
140140
self.skipTest("TSAN doesn't support threads after fork")
141+
if "forkserver" not in multiprocessing.get_all_start_methods():
142+
self.skipTest("forkserver start method is not available")
141143
return super().get_context()
142144

143145
def create_event(self):

Lib/test/test_json/test_decode.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ def test_empty_objects(self):
4848
self.assertEqual(self.loads('[]'), [])
4949
self.assertEqual(self.loads('""'), "")
5050

51+
def test_object_hook(self):
52+
s = '{"a":{"b":{}}}'
53+
54+
expected_result = {"a":{"b":{"x":1}, "x":1}, "x":1}
55+
expected_hook_arguments = [
56+
{}, {"b": {"x":1}}, {"a": {"b": {"x":1}, "x":1}}
57+
]
58+
59+
hook_arguments = []
60+
61+
def hook(x):
62+
hook_arguments.append(x)
63+
return {**x, "x":1}
64+
65+
result = self.loads(s, object_hook=hook)
66+
67+
self.assertEqual(result, expected_result)
68+
self.assertEqual(hook_arguments, expected_hook_arguments)
69+
70+
5171
def test_object_pairs_hook(self):
5272
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
5373
p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import json
2+
import pickle
3+
import unittest
4+
5+
class TestPickleable(unittest.TestCase):
6+
def test_json_decode_error_is_pickleable(self):
7+
e = json.JSONDecodeError(msg="abc", doc="def", pos=7)
8+
9+
pickled = pickle.dumps(e)
10+
unpickled = pickle.loads(pickled)
11+
12+
self.assertEqual(unpickled.msg, e.msg)
13+
self.assertEqual(unpickled.doc, e.doc)
14+
self.assertEqual(unpickled.pos, e.pos)

Lib/test/test_multiprocessing_forkserver/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import multiprocessing
12
import os.path
23
import sys
34
import unittest
@@ -9,5 +10,10 @@
910
if sys.platform == "win32":
1011
raise unittest.SkipTest("forkserver is not available on Windows")
1112

13+
# The forkserver start method requires passing file descriptors over a Unix
14+
# socket, which is not available on every platform (e.g. Solaris/illumos).
15+
if "forkserver" not in multiprocessing.get_all_start_methods():
16+
raise unittest.SkipTest("forkserver start method is not available")
17+
1218
def load_tests(*args):
1319
return support.load_package_tests(os.path.dirname(__file__), *args)

Lib/test/test_os.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -899,11 +899,18 @@ def support_subsecond(self, filename):
899899
or (st.st_mtime != st[8])
900900
or (st.st_ctime != st[9]))
901901

902+
def support_atime(self, filename):
903+
# Heuristic to check if the filesystem stores the access time.
904+
# Use whole seconds, to not depend on the timestamp resolution.
905+
os.utime(filename, (1, 2))
906+
return os.stat(filename).st_atime == 1
907+
902908
def _test_utime(self, set_time, filename=None):
903909
if not filename:
904910
filename = self.fname
905911

906912
support_subsecond = self.support_subsecond(filename)
913+
support_atime = self.support_atime(filename)
907914
if support_subsecond:
908915
# Timestamp with a resolution of 1 microsecond (10^-6).
909916
#
@@ -930,18 +937,22 @@ def _test_utime(self, set_time, filename=None):
930937
# digits worth of sub-second precision.
931938
# Some day it would be good to fix this upstream.
932939
delta=1e-5
933-
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-5)
940+
if support_atime:
941+
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-5)
942+
self.assertAlmostEqual(st.st_atime_ns, atime_ns, delta=1e9 * 1e-5)
934943
self.assertAlmostEqual(st.st_mtime, mtime_ns * 1e-9, delta=1e-5)
935-
self.assertAlmostEqual(st.st_atime_ns, atime_ns, delta=1e9 * 1e-5)
936944
self.assertAlmostEqual(st.st_mtime_ns, mtime_ns, delta=1e9 * 1e-5)
937945
else:
938946
if support_subsecond:
939-
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
947+
if support_atime:
948+
self.assertAlmostEqual(st.st_atime, atime_ns * 1e-9, delta=1e-6)
940949
self.assertAlmostEqual(st.st_mtime, mtime_ns * 1e-9, delta=1e-6)
941950
else:
942-
self.assertEqual(st.st_atime, atime_ns * 1e-9)
951+
if support_atime:
952+
self.assertEqual(st.st_atime, atime_ns * 1e-9)
943953
self.assertEqual(st.st_mtime, mtime_ns * 1e-9)
944-
self.assertEqual(st.st_atime_ns, atime_ns)
954+
if support_atime:
955+
self.assertEqual(st.st_atime_ns, atime_ns)
945956
self.assertEqual(st.st_mtime_ns, mtime_ns)
946957

947958
def test_utime(self):

0 commit comments

Comments
 (0)