diff options
author | Yaron de Leeuw <me@jarondl.net> | 2022-06-25 08:43:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-25 08:43:54 (GMT) |
commit | 50cd4b6959568999f5e426e58050ea912a490ac6 (patch) | |
tree | e4c74457bdec8383f9a7b9a7aa7509e76d4b064d /Doc | |
parent | 81e91c95a51daaa77efa3a3758ecba0475cfef38 (diff) | |
download | cpython-50cd4b6959568999f5e426e58050ea912a490ac6.zip cpython-50cd4b6959568999f5e426e58050ea912a490ac6.tar.gz cpython-50cd4b6959568999f5e426e58050ea912a490ac6.tar.bz2 |
bpo-26253: Add compressionlevel to tarfile stream (GH-2962)
`tarfile` already accepts a compressionlevel argument for creating
files. This patch adds the same for stream-based tarfile usage.
The default is 9, the value that was previously hard-coded.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/tarfile.rst | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst index f5c49b0..f9d34de 100644 --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -98,8 +98,8 @@ Some facts and figures: If *fileobj* is specified, it is used as an alternative to a :term:`file object` opened in binary mode for *name*. It is supposed to be at position 0. - For modes ``'w:gz'``, ``'r:gz'``, ``'w:bz2'``, ``'r:bz2'``, ``'x:gz'``, - ``'x:bz2'``, :func:`tarfile.open` accepts the keyword argument + For modes ``'w:gz'``, ``'x:gz'``, ``'w|gz'``, ``'w:bz2'``, ``'x:bz2'``, + ``'w|bz2'``, :func:`tarfile.open` accepts the keyword argument *compresslevel* (default ``9``) to specify the compression level of the file. For modes ``'w:xz'`` and ``'x:xz'``, :func:`tarfile.open` accepts the @@ -152,6 +152,9 @@ Some facts and figures: .. versionchanged:: 3.6 The *name* parameter accepts a :term:`path-like object`. + .. versionchanged:: 3.12 + The *compresslevel* keyword argument also works for streams. + .. class:: TarFile :noindex: |