Visitar URL original
[3.10] gh-102950: Implement PEP 706 – Filter for tarfile.extractall (GH-102953) by encukou · Pull Request #104327 · python/cpython · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix version numbers in documentation.
  • Loading branch information
mcepl committed May 4, 2023
commit abb0e8465034dd6e7f84218b360e88c8af88e6df
4 changes: 2 additions & 2 deletions Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
registered for that extension. In case none is found,
a :exc:`ValueError` is raised.

The keyword-only *filter* argument, which was added in Python 3.11.4,
The keyword-only *filter* argument, which was added in Python 3.10.12,
is passed to the underlying unpacking function.
For zip files, *filter* is not accepted.
For tar files, it is recommended to set it to ``'data'``,
Expand All @@ -655,7 +655,7 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
.. versionchanged:: 3.7
Accepts a :term:`path-like object` for *filename* and *extract_dir*.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12
Added the *filter* argument.

.. function:: register_unpack_format(name, extensions, function[, extra_args[, description]])
Expand Down
28 changes: 14 additions & 14 deletions Doc/library/tarfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ be finalized; only the internally used file object will be closed. See the
are used to set the owner/group for the extracted files. Otherwise, the named
values from the tarfile are used.

The *filter* argument, which was added in Python 3.11.4, specifies how
The *filter* argument, which was added in Python 3.10.12, specifies how
``members`` are modified or rejected before extraction.
See :ref:`tarfile-extraction-filter` for details.
It is recommended to set this explicitly depending on which *tar* features
Expand All @@ -452,7 +452,7 @@ be finalized; only the internally used file object will be closed. See the
.. versionchanged:: 3.6
The *path* parameter accepts a :term:`path-like object`.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12
Added the *filter* parameter.


Expand Down Expand Up @@ -488,7 +488,7 @@ be finalized; only the internally used file object will be closed. See the
.. versionchanged:: 3.6
The *path* parameter accepts a :term:`path-like object`.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12
Added the *filter* parameter.


Expand Down Expand Up @@ -526,7 +526,7 @@ be finalized; only the internally used file object will be closed. See the

.. attribute:: TarFile.extraction_filter

.. versionadded:: 3.11.4
.. versionadded:: 3.10.12

The :ref:`extraction filter <tarfile-extraction-filter>` used
as a default for the *filter* argument of :meth:`~TarFile.extract`
Expand Down Expand Up @@ -648,7 +648,7 @@ Different :class:`TarInfo` methods handle ``None`` differently:
- :meth:`~TarFile.list` will print a placeholder string.


.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12
Added :meth:`~TarInfo.replace` and handling of ``None``.


Expand Down Expand Up @@ -700,7 +700,7 @@ A ``TarInfo`` object has the following public data attributes:
Time of last modification in seconds since the :ref:`epoch <epoch>`,
as in :attr:`os.stat_result.st_mtime`.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12

Can be set to ``None`` for :meth:`~TarFile.extract` and
:meth:`~TarFile.extractall`, causing extraction to skip applying this
Expand All @@ -711,7 +711,7 @@ A ``TarInfo`` object has the following public data attributes:

Permission bits, as for :func:`os.chmod`.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12

Can be set to ``None`` for :meth:`~TarFile.extract` and
:meth:`~TarFile.extractall`, causing extraction to skip applying this
Expand All @@ -738,7 +738,7 @@ A ``TarInfo`` object has the following public data attributes:

User ID of the user who originally stored this member.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12

Can be set to ``None`` for :meth:`~TarFile.extract` and
:meth:`~TarFile.extractall`, causing extraction to skip applying this
Expand All @@ -749,7 +749,7 @@ A ``TarInfo`` object has the following public data attributes:

Group ID of the user who originally stored this member.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12

Can be set to ``None`` for :meth:`~TarFile.extract` and
:meth:`~TarFile.extractall`, causing extraction to skip applying this
Expand All @@ -760,7 +760,7 @@ A ``TarInfo`` object has the following public data attributes:

User name.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12

Can be set to ``None`` for :meth:`~TarFile.extract` and
:meth:`~TarFile.extractall`, causing extraction to skip applying this
Expand All @@ -771,7 +771,7 @@ A ``TarInfo`` object has the following public data attributes:

Group name.

.. versionchanged:: 3.11.4
.. versionchanged:: 3.10.12

Can be set to ``None`` for :meth:`~TarFile.extract` and
:meth:`~TarFile.extractall`, causing extraction to skip applying this
Expand All @@ -786,7 +786,7 @@ A ``TarInfo`` object has the following public data attributes:
uid=..., gid=..., uname=..., gname=...,
deep=True)

.. versionadded:: 3.11.4
.. versionadded:: 3.10.12

Return a *new* copy of the :class:`!TarInfo` object with the given attributes
changed. For example, to return a ``TarInfo`` with the group name set to
Expand Down Expand Up @@ -851,7 +851,7 @@ A :class:`TarInfo` object also provides some convenient query methods:
Extraction filters
------------------

.. versionadded:: 3.11.4
.. versionadded:: 3.10.12

The *tar* format is designed to capture all details of a UNIX-like filesystem,
which makes it very powerful.
Expand Down Expand Up @@ -1175,7 +1175,7 @@ Command-line options
Only string names are accepted (that is, ``fully_trusted``, ``tar``,
and ``data``).

.. versionadded:: 3.11.4
.. versionadded:: 3.10.12

.. _tar-examples:

Expand Down