Skip to content

Commit b6d2609

Browse files
committed
Fix outdated default compresslevel in gzip docs
The default compression level for gzip.open(), the GzipFile constructor and gzip.compress() was lowered from 9 to 6 (it now uses _COMPRESS_LEVEL_TRADEOFF), and the signatures and versionchanged notes were updated accordingly. A couple of docstrings and one paragraph in the library docs still said the default was 9, which was misleading. Update them to match the actual default of 6.
1 parent c5043dc commit b6d2609

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Doc/library/gzip.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The module defines the following items:
112112
The *compresslevel* argument is an integer from ``0`` to ``9`` controlling
113113
the level of compression; ``1`` is fastest and produces the least
114114
compression, and ``9`` is slowest and produces the most compression. ``0``
115-
is no compression. The default is ``9``.
115+
is no compression. The default is ``6``.
116116

117117
The optional *mtime* argument is the timestamp requested by gzip. The time
118118
is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. Set

‎Lib/gzip.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def open(filename, mode="rb", compresslevel=_COMPRESS_LEVEL_TRADEOFF,
3939
4040
The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab"
4141
for binary mode, or "rt", "wt", "xt" or "at" for text mode. The default
42-
mode is "rb", and the default compresslevel is 9.
42+
mode is "rb", and the default compresslevel is 6.
4343
4444
For binary mode, this function is equivalent to the GzipFile
4545
constructor: GzipFile(filename, mode, compresslevel). In this case,
@@ -186,7 +186,7 @@ def __init__(self, filename=None, mode=None,
186186
The compresslevel argument is an integer from 0 to 9 controlling
187187
the level of compression; 1 is fastest and produces the least
188188
compression, and 9 is slowest and produces the most compression.
189-
0 is no compression at all. The default is 9.
189+
0 is no compression at all. The default is 6.
190190
191191
The optional mtime argument is the timestamp requested by gzip.
192192
The time is in Unix format, i.e., seconds since 00:00:00 UTC,

0 commit comments

Comments
 (0)