diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 965da5981f6dbc..6320b04fc133d6 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -188,17 +188,15 @@ The module defines the following items: Compress the *data*, returning a :class:`bytes` object containing the compressed data. *compresslevel* and *mtime* have the same meaning as in - the :class:`GzipFile` constructor above. When *mtime* is set to ``0``, this - function is equivalent to :func:`zlib.compress` with *wbits* set to ``31``. - The zlib function is faster. + the :class:`GzipFile` constructor above. + :func:`zlib.compress` with *wbits* set to ``31`` is faster. .. versionadded:: 3.2 .. versionchanged:: 3.8 Added the *mtime* parameter for reproducible output. .. versionchanged:: 3.11 Speed is improved by compressing all data at once instead of in a - streamed fashion. Calls with *mtime* set to ``0`` are delegated to - :func:`zlib.compress` for better speed. + streamed fashion. .. function:: decompress(data) diff --git a/Lib/gzip.py b/Lib/gzip.py index 0d19c84c59cfa7..2bbb5b72c5b681 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -608,10 +608,6 @@ def compress(data, compresslevel=_COMPRESS_LEVEL_BEST, *, mtime=None): mtime can be used to set the modification time. The modification time is set to the current time by default. """ - if mtime == 0: - # Use zlib as it creates the header with 0 mtime by default. - # This is faster and with less overhead. - return zlib.compress(data, level=compresslevel, wbits=31) header = _create_simple_gzip_header(compresslevel, mtime) trailer = struct.pack("