Skip to content

Commit 8445723

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.7+ stable branch (2026-08-15)
Summary: Imported python/cpython `3.14.7+` from upstream rev [`422e679`](https://www.github.com/python/cpython/commit/422e6793fc3d64c289b37f0df08c782c8efcf2e8) (committed 2026-08-15 20:17:39+00:00). # Commit Info - Base: (`3.14.7+`) - [`f734bce`](https://www.github.com/python/cpython/commit/f734bce1693ae9ccfef2072c8a7a2acc6fc4003a) (commit date: 2026-08-14 04:11:19+00:00) - Imported: (`3.14.7+`) - [`422e679`](https://www.github.com/python/cpython/commit/422e6793fc3d64c289b37f0df08c782c8efcf2e8) (commit date: 2026-08-15 20:17:39+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=GEHjEyLgpGZq5VQGAFH5xxaJodlSbr0LAAAz Reviewed By: itamaro Differential Revision: D116209909 fbshipit-source-id: 465fc88ae4fb435bc27d2783be68d5188401d9ce
1 parent c7aea36 commit 8445723

13 files changed

Lines changed: 181 additions & 55 deletions

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ Include/internal/pycore_ast_state.h generated
7979
Include/internal/pycore_opcode.h generated
8080
Include/internal/pycore_opcode_metadata.h generated
8181
Include/internal/pycore_*_generated.h generated
82+
Include/internal/pycore_token.h generated
8283
Include/internal/pycore_uop_ids.h generated
8384
Include/internal/pycore_uop_metadata.h generated
8485
Include/opcode.h generated
8586
Include/opcode_ids.h generated
86-
Include/token.h generated
8787
Lib/_opcode_metadata.py generated
8888
Lib/idlelib/help.html generated
8989
Lib/keyword.py generated

Doc/library/annotationlib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ Functions
235235
annotate functions that support the :attr:`~Format.STRING` format but
236236
do not have access to the code creating the annotations.
237237

238-
For example, this is used to implement the :attr:`~Format.STRING` for
239-
:class:`typing.TypedDict` classes created through the functional syntax:
238+
For example, this is used to implement the :attr:`~Format.STRING` format
239+
for :class:`typing.TypedDict` classes created through the functional syntax:
240240

241241
.. doctest::
242242

Doc/library/time.rst

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,24 @@ An explanation of some terminology and conventions is in order.
122122
Functions
123123
---------
124124

125-
.. function:: asctime([t])
125+
.. function:: asctime([time_tuple])
126126

127127
Convert a tuple or :class:`struct_time` representing a time as returned by
128128
:func:`gmtime` or :func:`localtime` to a string of the following
129129
form: ``'Sun Jun 20 23:21:05 1993'``. The day field is two characters long
130130
and is space padded if the day is a single digit,
131-
e.g.: ``'Wed Jun 9 04:26:40 1993'``.
131+
for example: ``'Wed Jun 9 04:26:40 1993'``.
132132

133-
If *t* is not provided, the current time as returned by :func:`localtime`
134-
is used. Locale information is not used by :func:`asctime`.
133+
If *time_tuple* is not provided,
134+
the current time as returned by :func:`localtime` is used.
135+
Locale information is not used by :func:`asctime`.
135136

136137
.. note::
137138

138139
Unlike the C function of the same name, :func:`asctime` does not add a
139140
trailing newline.
140141

141-
.. function:: pthread_getcpuclockid(thread_id)
142+
.. function:: pthread_getcpuclockid(thread_id, /)
142143

143144
Return the *clk_id* of the thread-specific CPU-time clock for the specified *thread_id*.
144145

@@ -157,7 +158,7 @@ Functions
157158

158159
.. versionadded:: 3.7
159160

160-
.. function:: clock_getres(clk_id)
161+
.. function:: clock_getres(clk_id, /)
161162

162163
Return the resolution (precision) of the specified clock *clk_id*. Refer to
163164
:ref:`time-clock-id-constants` for a list of accepted values for *clk_id*.
@@ -167,7 +168,7 @@ Functions
167168
.. versionadded:: 3.3
168169

169170

170-
.. function:: clock_gettime(clk_id) -> float
171+
.. function:: clock_gettime(clk_id, /) -> float
171172

172173
Return the time of the specified clock *clk_id*. Refer to
173174
:ref:`time-clock-id-constants` for a list of accepted values for *clk_id*.
@@ -180,7 +181,7 @@ Functions
180181
.. versionadded:: 3.3
181182

182183

183-
.. function:: clock_gettime_ns(clk_id) -> int
184+
.. function:: clock_gettime_ns(clk_id, /) -> int
184185

185186
Similar to :func:`clock_gettime` but return time as nanoseconds.
186187

@@ -189,7 +190,7 @@ Functions
189190
.. versionadded:: 3.7
190191

191192

192-
.. function:: clock_settime(clk_id, time: float)
193+
.. function:: clock_settime(clk_id, time: float, /)
193194

194195
Set the time of the specified clock *clk_id*. Currently,
195196
:data:`CLOCK_REALTIME` is the only accepted value for *clk_id*.
@@ -202,7 +203,7 @@ Functions
202203
.. versionadded:: 3.3
203204

204205

205-
.. function:: clock_settime_ns(clk_id, time: int)
206+
.. function:: clock_settime_ns(clk_id, time: int, /)
206207

207208
Similar to :func:`clock_settime` but set time with nanoseconds.
208209

@@ -211,20 +212,20 @@ Functions
211212
.. versionadded:: 3.7
212213

213214

214-
.. function:: ctime([secs])
215+
.. function:: ctime(seconds=None, /)
215216

216217
Convert a time expressed in seconds since the epoch_ to a string of a form:
217218
``'Sun Jun 20 23:21:05 1993'`` representing local time. The day field
218219
is two characters long and is space padded if the day is a single digit,
219-
e.g.: ``'Wed Jun 9 04:26:40 1993'``.
220+
for example: ``'Wed Jun 9 04:26:40 1993'``.
220221

221-
If *secs* is not provided or :const:`None`, the current time as
222-
returned by :func:`.time` is used. ``ctime(secs)`` is equivalent to
223-
``asctime(localtime(secs))``. Locale information is not used by
222+
If *seconds* is not provided or :const:`None`, the current time as
223+
returned by :func:`.time` is used. ``ctime(seconds)`` is equivalent to
224+
``asctime(localtime(seconds))``. Locale information is not used by
224225
:func:`ctime`.
225226

226227

227-
.. function:: get_clock_info(name)
228+
.. function:: get_clock_info(name, /)
228229

229230
Get information on the specified clock as a namespace object.
230231
Supported clock names and the corresponding functions to read their value
@@ -249,21 +250,22 @@ Functions
249250
.. versionadded:: 3.3
250251

251252

252-
.. function:: gmtime([secs])
253+
.. function:: gmtime(seconds=None, /)
253254

254255
Convert a time expressed in seconds since the epoch_ to a :class:`struct_time` in
255-
UTC in which the dst flag is always zero. If *secs* is not provided or
256+
UTC in which the dst flag is always zero. If *seconds* is not provided or
256257
:const:`None`, the current time as returned by :func:`.time` is used. Fractions
257258
of a second are ignored. See above for a description of the
258259
:class:`struct_time` object. See :func:`calendar.timegm` for the inverse of this
259260
function.
260261

261262

262-
.. function:: localtime([secs])
263+
.. function:: localtime(seconds=None, /)
263264

264-
Like :func:`gmtime` but converts to local time. If *secs* is not provided or
265-
:const:`None`, the current time as returned by :func:`.time` is used. The dst
266-
flag is set to ``1`` when DST applies to the given time.
265+
Like :func:`gmtime` but converts to local time.
266+
If *seconds* is not provided or :const:`None`,
267+
the current time as returned by :func:`.time` is used.
268+
The dst flag is set to ``1`` when DST applies to the given time.
267269

268270
:func:`localtime` may raise :exc:`OverflowError`, if the timestamp is
269271
outside the range of values supported by the platform C :c:func:`localtime`
@@ -272,7 +274,7 @@ Functions
272274
between 1970 and 2038.
273275

274276

275-
.. function:: mktime(t)
277+
.. function:: mktime(time_tuple, /)
276278

277279
This is the inverse function of :func:`localtime`. Its argument is the
278280
:class:`struct_time` or full 9-tuple (since the dst flag is needed; use ``-1``
@@ -379,7 +381,7 @@ Functions
379381

380382
.. versionadded:: 3.7
381383

382-
.. function:: sleep(secs)
384+
.. function:: sleep(seconds, /)
383385

384386
Suspend execution of the calling thread for the given number of seconds.
385387
The argument may be a floating-point number to indicate a more precise sleep
@@ -393,13 +395,16 @@ Functions
393395

394396
.. rubric:: Windows implementation
395397

396-
On Windows, if *secs* is zero, the thread relinquishes the remainder of its
397-
time slice to any other thread that is ready to run. If there are no other
398-
threads ready to run, the function returns immediately, and the thread
399-
continues execution. On Windows 10 and newer the implementation uses
398+
On Windows, if *seconds* is zero,
399+
the thread relinquishes the remainder of its time slice
400+
to any other thread that is ready to run.
401+
If there are no other threads ready to run,
402+
the function returns immediately, and the thread continues execution.
403+
On Windows 10 and newer the implementation uses
400404
a `high-resolution timer
401405
<https://learn.microsoft.com/windows/win32/api/synchapi/nf-synchapi-createwaitabletimerexw>`_
402-
which provides resolution of 100 nanoseconds. If *secs* is zero, ``Sleep(0)`` is used.
406+
which provides resolution of 100 nanoseconds.
407+
If *seconds* is zero, ``Sleep(0)`` is used.
403408

404409
.. rubric:: Unix implementation
405410

@@ -414,12 +419,13 @@ Functions
414419
To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling
415420
policy <os-scheduling-policy>` and use :func:`os.sched_yield` instead.
416421

417-
.. audit-event:: time.sleep secs
422+
.. audit-event:: time.sleep seconds
418423

419424
.. versionchanged:: 3.5
420-
The function now sleeps at least *secs* even if the sleep is interrupted
421-
by a signal, except if the signal handler raises an exception (see
422-
:pep:`475` for the rationale).
425+
The function now sleeps at least *seconds*
426+
even if the sleep is interrupted by a signal,
427+
except if the signal handler raises an exception
428+
(see :pep:`475` for the rationale).
423429

424430
.. versionchanged:: 3.11
425431
On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now
@@ -431,13 +437,13 @@ Functions
431437
.. index::
432438
single: % (percent); datetime format
433439

434-
.. function:: strftime(format[, t])
440+
.. function:: strftime(format[, time_tuple])
435441

436442
Convert a tuple or :class:`struct_time` representing a time as returned by
437443
:func:`gmtime` or :func:`localtime` to a string as specified by the *format*
438-
argument. If *t* is not provided, the current time as returned by
444+
argument. If *time_tuple* is not provided, the current time as returned by
439445
:func:`localtime` is used. *format* must be a string. :exc:`ValueError` is
440-
raised if any field in *t* is outside of the allowed range.
446+
raised if any field in *time_tuple* is outside of the allowed range.
441447

442448
0 is a legal argument for any position in the time tuple; if it is normally
443449
illegal the value is forced to a correct one.

Lib/tarfile.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,17 +1616,22 @@ def _proc_pax(self, tarfile):
16161616
if self.type in (XHDTYPE, SOLARIS_XHDTYPE):
16171617
# Patch the TarInfo object with the extended header info.
16181618
next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
1619-
next.offset = self.offset
16201619

16211620
if "size" in pax_headers:
16221621
# If the extended header replaces the size field,
16231622
# we need to recalculate the offset where the next
16241623
# header starts.
1625-
offset = next.offset_data
1624+
offset = next.offset + BLOCKSIZE
16261625
if next.isreg() or next.type not in SUPPORTED_TYPES:
1627-
offset += next._block(next.size)
1626+
try:
1627+
size = PAX_NUMBER_FIELDS["size"](pax_headers["size"])
1628+
except ValueError:
1629+
size = 0
1630+
offset += next._block(size)
16281631
tarfile.offset = offset
16291632

1633+
next.offset = self.offset
1634+
16301635
return next
16311636

16321637
def _proc_gnusparse_00(self, next, raw_headers):

Lib/test/_test_multiprocessing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,7 @@ def test_repr_lock(self):
15641564
event.wait()
15651565
self.assertEqual(f'<Lock(owner=SomeOtherProcess)>', repr(lock))
15661566
p.terminate()
1567+
p.join()
15671568

15681569
def test_lock(self):
15691570
lock = self.Lock()

Lib/test/test_copy.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class C(object):
6060
def __reduce_ex__(self, proto):
6161
c.append(1)
6262
return ""
63-
def __reduce__(self):
63+
def __reduce__(*args):
6464
self.fail("shouldn't call this")
6565
c = []
6666
x = C()
@@ -70,9 +70,15 @@ def __reduce__(self):
7070

7171
def test_copy_reduce(self):
7272
class C(object):
73+
def __reduce_ex__(*args):
74+
self.fail("shouldn't call this")
7375
def __reduce__(self):
7476
c.append(1)
7577
return ""
78+
def __getattribute__(self, name):
79+
if name == "__reduce_ex__":
80+
raise AttributeError(name)
81+
return object.__getattribute__(self, name)
7682
c = []
7783
x = C()
7884
y = copy.copy(x)
@@ -323,7 +329,7 @@ class C(object):
323329
def __reduce_ex__(self, proto):
324330
c.append(1)
325331
return ""
326-
def __reduce__(self):
332+
def __reduce__(*args):
327333
self.fail("shouldn't call this")
328334
c = []
329335
x = C()
@@ -333,9 +339,15 @@ def __reduce__(self):
333339

334340
def test_deepcopy_reduce(self):
335341
class C(object):
342+
def __reduce_ex__(*args):
343+
self.fail("shouldn't call this")
336344
def __reduce__(self):
337345
c.append(1)
338346
return ""
347+
def __getattribute__(self, name):
348+
if name == "__reduce_ex__":
349+
raise AttributeError(name)
350+
return object.__getattribute__(self, name)
339351
c = []
340352
x = C()
341353
y = copy.deepcopy(x)

Lib/test/test_tarfile.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,37 @@ def test_sparse_file_01(self):
13661366
def test_sparse_file_10(self):
13671367
self._test_sparse_file("gnu/sparse-1.0")
13681368

1369+
def test_sparse_file_10_pax_size(self):
1370+
# gh-83869: when the pax header replaces the size field, the offset
1371+
# of the next header must be computed from the size of the data in
1372+
# the archive, not from the apparent size of the sparse file.
1373+
data = b"payload!" * 4
1374+
realsize = 1 << 20
1375+
smap = b"1\n%d\n%d\n" % (realsize - len(data), len(data))
1376+
smap += b"\0" * (-len(smap) % tarfile.BLOCKSIZE)
1377+
1378+
sparse = tarfile.TarInfo("sparse")
1379+
sparse.size = len(smap) + len(data)
1380+
sparse.pax_headers = {
1381+
"GNU.sparse.major": "1",
1382+
"GNU.sparse.minor": "0",
1383+
"GNU.sparse.name": "sparse",
1384+
"GNU.sparse.realsize": str(realsize),
1385+
"size": str(sparse.size),
1386+
}
1387+
buf = sparse.tobuf(tarfile.PAX_FORMAT)
1388+
buf += smap + data + b"\0" * (-len(data) % tarfile.BLOCKSIZE)
1389+
1390+
last = tarfile.TarInfo("last")
1391+
last.size = len(data)
1392+
buf += last.tobuf(tarfile.PAX_FORMAT)
1393+
buf += data + b"\0" * (-len(data) % tarfile.BLOCKSIZE)
1394+
buf += b"\0" * (tarfile.BLOCKSIZE * 2)
1395+
1396+
with tarfile.open(fileobj=io.BytesIO(buf)) as tar:
1397+
self.assertEqual(tar.getnames(), ["sparse", "last"])
1398+
self.assertEqual(tar.extractfile("last").read(), data)
1399+
13691400
@staticmethod
13701401
def _fs_supports_holes():
13711402
# Return True if the platform knows the st_blocks stat attribute and
@@ -1418,6 +1449,31 @@ def test_pax_global_headers(self):
14181449
finally:
14191450
tar.close()
14201451

1452+
def test_offset_after_global_header(self):
1453+
# gh-83869: a global header is a member of its own, the member which
1454+
# follows it keeps the offset of its own header.
1455+
rec = b"30 comment=global header here\n"
1456+
glob = tarfile.TarInfo("././@PaxHeader")
1457+
glob.type = tarfile.XGLTYPE
1458+
glob.size = len(rec)
1459+
buf = glob.tobuf(tarfile.USTAR_FORMAT)
1460+
buf += rec + b"\0" * (-len(rec) % tarfile.BLOCKSIZE)
1461+
1462+
member = tarfile.TarInfo("member")
1463+
data = b"hello\n"
1464+
member.size = len(data)
1465+
offset = len(buf)
1466+
buf += member.tobuf(tarfile.USTAR_FORMAT)
1467+
buf += data + b"\0" * (-len(data) % tarfile.BLOCKSIZE)
1468+
buf += b"\0" * (tarfile.BLOCKSIZE * 2)
1469+
1470+
with tarfile.open(fileobj=io.BytesIO(buf)) as tar:
1471+
tarinfo = tar.getmember("member")
1472+
self.assertEqual(tarinfo.offset, offset)
1473+
self.assertEqual(tarinfo.pax_headers.get("comment"),
1474+
"global header here")
1475+
self.assertEqual(tar.extractfile(tarinfo).read(), data)
1476+
14211477
def test_pax_number_fields(self):
14221478
# All following number fields are read from the pax header.
14231479
tar = tarfile.open(tarname, encoding="iso8859-1")

0 commit comments

Comments
 (0)