Skip to content

Commit 461178f

Browse files
committed
add versionchanged note
1 parent 7ba376e commit 461178f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Doc/library/tarfile.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Some facts and figures:
110110

111111
For modes ``'w:gz'``, ``'x:gz'``, ``'w|gz'``, ``'w:bz2'``, ``'x:bz2'``,
112112
``'w|bz2'``, :func:`tarfile.open` accepts the keyword argument
113-
*compresslevel* (default ``9``) to specify the compression level of the file.
113+
*compresslevel* (default ``6``) to specify the compression level of the file.
114114

115115
For modes ``'w:xz'``, ``'x:xz'`` and ``'w|xz'``, :func:`tarfile.open` accepts the
116116
keyword argument *preset* to specify the compression level of the file.
@@ -170,6 +170,10 @@ Some facts and figures:
170170
.. versionchanged:: 3.14
171171
The *preset* keyword argument also works for streams.
172172

173+
.. versionchanged:: 3.14
174+
The default compression level was reduced to 6 (down from 9).
175+
It is the default level used by most compression tools and a better
176+
tradeoff between speed and performance.
173177

174178
.. class:: TarFile
175179
:noindex:

Lib/tarfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,7 @@ def not_compressed(comptype):
19271927
if "preset" in kwargs and comptype not in ("xz",):
19281928
raise ValueError("preset is only valid for w|xz mode")
19291929

1930-
compresslevel = kwargs.pop("compresslevel", 9)
1930+
compresslevel = kwargs.pop("compresslevel", 6)
19311931
preset = kwargs.pop("preset", None)
19321932
stream = _Stream(name, filemode, comptype, fileobj, bufsize,
19331933
compresslevel, preset)

0 commit comments

Comments
 (0)