Skip to content

Commit 38a337e

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.7+ stable branch (2026-08-20)
Summary: Imported python/cpython `3.14.7+` from upstream rev [`cb76caa`](https://www.github.com/python/cpython/commit/cb76caaa6467f0ae8f9d58b5956211ed855a8905) (committed 2026-08-20 01:52:17+00:00). # Commit Info - Base: (`3.14.7+`) - [`90a1f02`](https://www.github.com/python/cpython/commit/90a1f02b7da0c356d10a23f1faee7dc063f887ed) (commit date: 2026-08-18 13:09:24+00:00) - Imported: (`3.14.7+`) - [`cb76caa`](https://www.github.com/python/cpython/commit/cb76caaa6467f0ae8f9d58b5956211ed855a8905) (commit date: 2026-08-20 01:52:17+00:00) # Noteworthy file changes - Low-signal files (1 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GBUqjSB4cps3hbkDAKjvKW5V5M8Lbr0LAAAz Reviewed By: itamaro Differential Revision: D116769448 fbshipit-source-id: 663aae0327fba5ae554bce1786ab3fe5f5ba0d98
1 parent e1c7151 commit 38a337e

8 files changed

Lines changed: 59 additions & 26 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
check-abi:
5353
name: 'Check if the ABI has changed'
5454
runs-on: ubuntu-22.04 # 24.04 causes spurious errors
55+
timeout-minutes: 30
5556
needs: build-context
5657
if: needs.build-context.outputs.run-tests == 'true'
5758
steps:

Doc/library/asyncio-task.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -853,17 +853,13 @@ Timeouts
853853
Wait for the *aw* :ref:`awaitable <asyncio-awaitables>`
854854
to complete with a timeout.
855855

856-
If *aw* is a coroutine it is automatically scheduled as a Task.
857-
858856
*timeout* can either be ``None`` or a float or int number of seconds
859857
to wait for. If *timeout* is ``None``, block until the future
860858
completes.
861859

862-
If a timeout occurs, it cancels the task and raises
863-
:exc:`TimeoutError`.
860+
If a timeout occurs, it cancels *aw* and raises :exc:`TimeoutError`.
864861

865-
To avoid the task :meth:`cancellation <Task.cancel>`,
866-
wrap it in :func:`shield`.
862+
To prevent *aw* from being cancelled, wrap it in :func:`shield`.
867863

868864
The function will wait until the future is actually cancelled,
869865
so the total wait time may exceed the *timeout*. If an exception
@@ -904,6 +900,10 @@ Timeouts
904900
.. versionchanged:: 3.11
905901
Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`.
906902

903+
.. versionchanged:: 3.12
904+
Implemented using :func:`asyncio.timeout`, a coroutine passed as *aw*
905+
is no longer wrapped in a :class:`Task` when *timeout* is positive.
906+
907907

908908
Waiting primitives
909909
==================

Doc/library/stdtypes.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ A hexadecimal string takes the form::
706706

707707
[sign] ['0x'] integer ['.' fraction] ['p' exponent]
708708

709-
where the optional ``sign`` may by either ``+`` or ``-``, ``integer``
709+
where the optional ``sign`` may be either ``+`` or ``-``, ``integer``
710710
and ``fraction`` are strings of hexadecimal digits, and ``exponent``
711711
is a decimal integer with an optional leading sign. Case is not
712712
significant, and there must be at least one hexadecimal digit in
@@ -1345,7 +1345,7 @@ Mutable sequence types also support the following methods:
13451345
:no-typesetting:
13461346
.. method:: sequence.pop(index=-1, /)
13471347

1348-
Retrieve the item at *index* and also removes it from *sequence*.
1348+
Retrieve the item at *index* and also remove it from *sequence*.
13491349
By default, the last item in *sequence* is removed and returned.
13501350

13511351
.. method:: bytearray.remove(value, /)
@@ -2120,7 +2120,7 @@ expression support in the :mod:`re` module).
21202120
one character, ``False`` otherwise. Alphabetic characters are those characters defined
21212121
in the Unicode character database as "Letter", i.e., those with general category
21222122
property being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is different
2123-
from the `Alphabetic property defined in the section 4.10 'Letters, Alphabetic, and
2123+
from the `Alphabetic property defined in section 4.10 'Letters, Alphabetic, and
21242124
Ideographic' of the Unicode Standard
21252125
<https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-4/#G91002>`_.
21262126
For example:
@@ -3032,7 +3032,7 @@ replacement field. For example::
30323032
'0.333333'
30333033
>>> f'{one_third:_^+10}'
30343034
'___+1/3___'
3035-
>>> >>> f'{one_third!r:_^20}'
3035+
>>> f'{one_third!r:_^20}'
30363036
'___Fraction(1, 3)___'
30373037
>>> f'{one_third = :~>10}~'
30383038
'one_third = ~~~~~~~1/3~'
@@ -3042,12 +3042,12 @@ replacement field. For example::
30423042
Template String Literals (t-strings)
30433043
------------------------------------
30443044

3045-
An :dfn:`t-string` (formally a :dfn:`template string literal`) is
3045+
A :dfn:`t-string` (formally a :dfn:`template string literal`) is
30463046
a string literal that is prefixed with ``t`` or ``T``.
30473047

30483048
These strings follow the same syntax and evaluation rules as
30493049
:ref:`formatted string literals <stdtypes-fstrings>`,
3050-
with for the following differences:
3050+
with the following differences:
30513051

30523052
* Rather than evaluating to a ``str`` object, template string literals evaluate
30533053
to a :class:`string.templatelib.Template` object.
@@ -3074,7 +3074,7 @@ with for the following differences:
30743074
The :class:`!Interpolation` instance for the expression will be created as
30753075
normal, except that :attr:`~string.templatelib.Interpolation.conversion` will
30763076
be set to '``r``' (:func:`repr`) by default.
3077-
If an explicit conversion or format specifier are provided,
3077+
If an explicit conversion or format specifier is provided,
30783078
this will override the default behaviour.
30793079

30803080

@@ -3451,7 +3451,7 @@ objects.
34513451

34523452
.. classmethod:: fromhex(string, /)
34533453

3454-
This :class:`bytearray` class method returns bytearray object, decoding
3454+
This :class:`bytearray` class method returns a bytearray object, decoding
34553455
the given string object. The string must contain two hexadecimal digits
34563456
per byte, with ASCII whitespace being ignored.
34573457

@@ -4387,7 +4387,7 @@ the ``%`` operator (modulo).
43874387
This is also known as the bytes *formatting* or *interpolation* operator.
43884388
Given ``format % values`` (where *format* is a bytes object), ``%`` conversion
43894389
specifications in *format* are replaced with zero or more elements of *values*.
4390-
The effect is similar to using the :c:func:`sprintf` in the C language.
4390+
The effect is similar to using the :c:func:`sprintf` function in the C language.
43914391

43924392
If *format* requires a single argument, *values* may be a single non-tuple
43934393
object. [5]_ Otherwise, *values* must be a tuple with exactly the number of
@@ -4587,8 +4587,8 @@ copying.
45874587
:class:`!memoryview`\s are :ref:`generic <generics>` over the type of their
45884588
underlying data.
45894589

4590-
``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which
4591-
is the nested list representation of the view. If ``view.ndim = 1``,
4590+
``len(view)`` is equal to the length of :meth:`~memoryview.tolist`, which
4591+
is the nested list representation of the view. If ``view.ndim == 1``,
45924592
this is equal to the number of elements in the view.
45934593

45944594
.. versionchanged:: 3.12
@@ -4673,7 +4673,7 @@ copying.
46734673
:class:`collections.abc.Sequence`
46744674

46754675
.. versionchanged:: 3.5
4676-
memoryviews can now be indexed with tuple of integers.
4676+
memoryviews can now be indexed with a tuple of integers.
46774677

46784678
.. versionchanged:: 3.14
46794679
memoryview is now a :term:`generic type`.
@@ -6073,7 +6073,7 @@ enables cleaner type hinting syntax compared to subscripting :class:`typing.Unio
60736073

60746074
.. note::
60756075

6076-
The ``|`` operand cannot be used at runtime to define unions where one or
6076+
The ``|`` operator cannot be used at runtime to define unions where one or
60776077
more members is a forward reference. For example, ``int | "Foo"``, where
60786078
``"Foo"`` is a reference to a class not yet defined, will fail at
60796079
runtime. For unions which include forward references, present the
@@ -6232,7 +6232,7 @@ Methods
62326232
Methods are functions that are called using the attribute notation.
62336233
There are two flavors: :ref:`built-in methods <builtin-methods>`
62346234
(such as :meth:`~list.append` on lists)
6235-
and :ref:`class instance method <instance-methods>`.
6235+
and :ref:`class instance methods <instance-methods>`.
62366236
Built-in methods are described with the types that support them.
62376237

62386238
If you access a method (a function defined in a class namespace) through an

Doc/library/tarfile.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,10 @@ reused in custom filters:
11001100
paths (in case the name is absolute
11011101
even after stripping slashes, e.g. ``C:/foo`` on Windows).
11021102
This raises :class:`~tarfile.AbsolutePathError`.
1103+
- Normalize filenames (:attr:`TarInfo.name`) that contain ``..`` components
1104+
using :func:`os.path.normpath`.
1105+
Note that this removes internal ``..`` components, which may change the
1106+
meaning of the name if it traverses symbolic links.
11031107
- :ref:`Refuse <tarfile-extraction-refuse>` to extract files whose absolute
11041108
path (after following symlinks) would end up outside the destination.
11051109
This raises :class:`~tarfile.OutsideDestinationError`.
@@ -1108,6 +1112,10 @@ reused in custom filters:
11081112

11091113
Return the modified ``TarInfo`` member.
11101114

1115+
.. versionchanged:: next
1116+
1117+
Filenames containing ``..`` components are now normalized.
1118+
11111119
.. function:: data_filter(member, path)
11121120

11131121
Implements the ``'data'`` filter.

Lib/asyncio/tasks.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,13 @@ def _release_waiter(waiter, *args):
440440
async def wait_for(fut, timeout):
441441
"""Wait for the single Future or coroutine to complete, with timeout.
442442
443-
Coroutine will be wrapped in Task.
444-
445443
Returns result of the Future or coroutine. When a timeout occurs,
446-
it cancels the task and raises TimeoutError. To avoid the task
447-
cancellation, wrap it in shield().
444+
it cancels fut and raises TimeoutError. To prevent fut from being
445+
cancelled, wrap it in shield().
448446
449-
If the wait is cancelled, the task is also cancelled.
447+
If the wait is cancelled, fut is also cancelled.
450448
451-
If the task suppresses the cancellation and returns a value instead,
449+
If fut suppresses the cancellation and returns a value instead,
452450
that value is returned.
453451
454452
This function is a coroutine.

Lib/tarfile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,13 @@ def _get_filtered_attrs(member, dest_path, for_data=True):
819819
# For example, 'C:/foo' on Windows.
820820
raise AbsolutePathError(member)
821821
# Ensure we stay in the destination
822+
if '..' in name.replace(os.sep, '/').split('/'):
823+
# Directories are created from the name as given, so a name that
824+
# leaves the destination part-way through would create them
825+
# outside it even if the resolved path stays inside.
826+
normalized = os.path.normpath(name)
827+
if normalized != name:
828+
name = new_attrs['name'] = normalized
822829
target_path = os.path.realpath(os.path.join(dest_path, name),
823830
strict=os.path.ALLOW_MISSING)
824831
if os.path.commonpath([target_path, dest_path]) != dest_path:

Lib/test/test_tarfile.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,6 +3981,20 @@ def test_absolute(self):
39813981
tarfile.AbsolutePathError,
39823982
"""['"].*escaped.evil['"] has an absolute path""")
39833983

3984+
def test_parent_dir_out_and_back(self):
3985+
# Test a member that leaves the destination and comes back.
3986+
# The containment check looks at the resolved path, which stays
3987+
# inside, but the intermediate directories are created from the
3988+
# name as given, which does not.
3989+
with ArchiveMaker() as arc:
3990+
arc.add(f'../escaped.evil/../{self.destdir.name}/sub/file',
3991+
content='content')
3992+
3993+
for filter in 'tar', 'data':
3994+
with self.subTest(filter):
3995+
with self.check_context(arc.open(), filter):
3996+
self.expect_file('sub/file', content='content')
3997+
39843998
@symlink_test
39853999
def test_parent_symlink(self):
39864000
# Test interplaying symlinks
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Fix the :mod:`tarfile` ``tar`` and ``data`` extraction filters creating
2+
directories outside the destination for members whose name leaves the
3+
destination and returns to it, such as ``../evil/../dest/sub/file``. The
4+
containment check used the resolved path, but intermediate directories were
5+
created from the name as given.

0 commit comments

Comments
 (0)