File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,9 @@ The module defines the following items:
196196 .. versionchanged :: 3.11
197197 Speed is improved by compressing all data at once instead of in a
198198 streamed fashion. Calls with *mtime * set to ``0 `` are delegated to
199- :func: `zlib.compress ` for better speed.
199+ :func: `zlib.compress ` for better speed. In this situation the
200+ output may contain a gzip header "OS" byte value other than 255
201+ "unknown" as supplied by the underlying zlib implementation.
200202
201203 .. versionchanged :: 3.13
202204 The gzip header OS byte is guaranteed to be set to 255 when this function
Original file line number Diff line number Diff line change @@ -768,6 +768,21 @@ functools
768768 (Contributed by Yurii Karabas in :issue: `46014 `.)
769769
770770
771+ .. _whatsnew311-gzip :
772+
773+ gzip
774+ ----
775+
776+ * The :func: `gzip.compress ` function is now faster when used with the
777+ **mtime=0 ** argument as it delegates the compression entirely to a single
778+ :func: `zlib.compress ` operation. There is one side effect of this change: The
779+ gzip file header contains an "OS" byte in its header. That was traditionally
780+ always set to a value of 255 representing "unknown" by the :mod: `gzip `
781+ module. Now, when using :func: `~gzip.compress ` with **mtime=0 **, it may be
782+ set to a different value by the underlying zlib C library Python was linked
783+ against.
784+ (See :gh: `112346 ` for details on the side effect.)
785+
771786.. _whatsnew311-hashlib :
772787
773788hashlib
You can’t perform that action at this time.
0 commit comments