https://github.com/python/cpython/commit/1b0e63c81b54a937b089fe335761cba4a96c8cdf commit: 1b0e63c81b54a937b089fe335761cba4a96c8cdf branch: 3.11 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: pablogsal <pablog...@gmail.com> date: 2024-06-17T19:01:59+01:00 summary:
[3.11] gh-112346: Document the OS byte in `gzip.compress` output change in 3.11 (GH-120480) (#120614) files: M Doc/library/gzip.rst M Doc/whatsnew/3.11.rst diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 5af667a17d003f..aa2c8e717a3699 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -190,7 +190,9 @@ The module defines the following items: .. 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. + :func:`zlib.compress` for better speed. In this situation the + output may contain a gzip header "OS" byte value other than 255 + "unknown" as supplied by the underlying zlib implementation. .. function:: decompress(data) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index d79c2a29604a4a..37757212349e06 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -769,6 +769,21 @@ functools (Contributed by Yurii Karabas in :issue:`46014`.) +.. _whatsnew311-gzip: + +gzip +---- + +* The :func:`gzip.compress` function is now faster when used with the + **mtime=0** argument as it delegates the compression entirely to a single + :func:`zlib.compress` operation. There is one side effect of this change: The + gzip file header contains an "OS" byte in its header. That was traditionally + always set to a value of 255 representing "unknown" by the :mod:`gzip` + module. Now, when using :func:`~gzip.compress` with **mtime=0**, it may be + set to a different value by the underlying zlib C library Python was linked + against. + (See :gh:`112346` for details on the side effect.) + .. _whatsnew311-hashlib: hashlib _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com