https://github.com/python/cpython/commit/ef377463b6a597ca1349d3c3feeecd90a93cb1bb
commit: ef377463b6a597ca1349d3c3feeecd90a93cb1bb
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-10-22T10:34:32Z
summary:

[3.15] gh-91349: Update `gzip` docs and docstrings for the default 
compresslevel of 6 (GH-159439) (#160096)

(cherry picked from commit 49aed47e5d85069f604713b79bd73668c69fbece)

Co-authored-by: Steve Kowalik <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Doc/library/gzip.rst
M Lib/gzip.py

diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst
index 2c667ddc522399..fb4e060f9023d1 100644
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -105,7 +105,7 @@ The module defines the following items:
    The *compresslevel* argument is an integer from ``0`` to ``9`` controlling
    the level of compression; ``1`` is fastest and produces the least
    compression, and ``9`` is slowest and produces the most compression. ``0``
-   is no compression. The default is ``9``.
+   is no compression. The default is ``6``.
 
    The optional *mtime* argument is the timestamp requested by gzip. The time
    is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. Set
diff --git a/Lib/gzip.py b/Lib/gzip.py
index c7b4563fdfe991..b50089c31fadc8 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -39,7 +39,7 @@ def open(filename, mode="rb", 
compresslevel=_COMPRESS_LEVEL_TRADEOFF,
 
     The mode argument can be "r", "rb", "w", "wb", "x", "xb", "a" or "ab"
     for binary mode, or "rt", "wt", "xt" or "at" for text mode.  The default
-    mode is "rb", and the default compresslevel is 9.
+    mode is "rb", and the default compresslevel is 6.
 
     For binary mode, this function is equivalent to the GzipFile
     constructor: GzipFile(filename, mode, compresslevel).  In this case,
@@ -185,7 +185,7 @@ def __init__(self, filename=None, mode=None,
         The compresslevel argument is an integer from 0 to 9 controlling
         the level of compression; 1 is fastest and produces the least
         compression, and 9 is slowest and produces the most compression.
-        0 is no compression at all. The default is 9.
+        0 is no compression at all. The default is 6.
 
         The optional mtime argument is the timestamp requested by gzip.
         The time is in Unix format, i.e., seconds since 00:00:00 UTC,

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to