]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #15677: Document that zlib and gzip accept a compression level of 0 to mean...
authorNadeem Vawda <nadeem.vawda@gmail.com>
Sun, 11 Nov 2012 12:52:10 +0000 (13:52 +0100)
committerNadeem Vawda <nadeem.vawda@gmail.com>
Sun, 11 Nov 2012 12:52:10 +0000 (13:52 +0100)
Patch by Brian Brazil.

Doc/library/gzip.rst
Doc/library/zlib.rst
Lib/gzip.py
Misc/ACKS
Misc/NEWS

index 470de08906cce5f34ffbc2526ae8d7743be65aab..465510f6b6e6af1c041a105b373937f13ec65276 100644 (file)
@@ -49,9 +49,10 @@ The module defines the following items:
    not given, the 'b' flag will be added to the mode to ensure the file is opened
    in binary mode for cross-platform portability.
 
-   The *compresslevel* argument is an integer from ``1`` to ``9`` controlling the
-   level of compression; ``1`` is fastest and produces the least compression, and
-   ``9`` is slowest and produces the most compression.  The default is ``9``.
+   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``.
 
    The *mtime* argument is an optional numeric timestamp to be written to
    the stream when compressing.  All :program:`gzip` compressed streams are
index bd08f7f6a09f41c346579da2e28a1cd01183e4fa..a3a27c57369e1101958db4dd846f63b8bf038a5f 100644 (file)
@@ -62,18 +62,19 @@ The available exception and functions in this module are:
 .. function:: compress(string[, level])
 
    Compresses the data in *string*, returning a string contained compressed data.
-   *level* is an integer from ``1`` to ``9`` controlling the level of compression;
+   *level* is an integer from ``0`` to ``9`` controlling the level of compression;
    ``1`` is fastest and produces the least compression, ``9`` is slowest and
-   produces the most.  The default value is ``6``.  Raises the :exc:`error`
-   exception if any error occurs.
+   produces the most.  ``0`` is no compression.  The default value is ``6``.
+   Raises the :exc:`error` exception if any error occurs.
 
 
 .. function:: compressobj([level])
 
    Returns a compression object, to be used for compressing data streams that won't
-   fit into memory at once.  *level* is an integer from ``1`` to ``9`` controlling
+   fit into memory at once.  *level* is an integer from ``0`` to ``9`` controlling
    the level of compression; ``1`` is fastest and produces the least compression,
-   ``9`` is slowest and produces the most.  The default value is ``6``.
+   ``9`` is slowest and produces the most.  ``0`` is no compression.  The default
+   value is ``6``.
 
 
 .. function:: crc32(data[, value])
index 92a7eea0bcddf831c37eadc239211b155d167181..a613bae876dd3444162a81f21875c75133d21a42 100644 (file)
@@ -66,9 +66,10 @@ class GzipFile(io.BufferedIOBase):
         Be aware that only the 'rb', 'ab', and 'wb' values should be used
         for cross-platform portability.
 
-        The compresslevel argument is an integer from 1 to 9 controlling the
+        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.  The default is 9.
+        and 9 is slowest and produces the most compression. 0 is no compression
+        at all. The default is 9.
 
         The mtime argument is an optional numeric timestamp to be written
         to the stream when compressing.  All gzip compressed streams
index 01bc45ecb81643ab69f8e2ff275082089ff48b9d..3604dd037293a3e914f02e06f6606ea69c2370a5 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -120,6 +120,7 @@ Monty Brandenberg
 Georg Brandl
 Christopher Brannon
 Terrence Brannon
+Brian Brazil
 Dave Brennan
 Tom Bridgman
 Keith Briggs
index 96c8614345cbaf3c251687cd73eb52a40700eddd..d5a048e2bbf30448a1e736f54b7ffdd395b0c2fb 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -556,6 +556,9 @@ Tools/Demos
 Documentation
 -------------
 
+- Issue #15677: Document that zlib and gzip accept a compression level of 0 to
+  mean 'no compression'. Patch by Brian Brazil.
+
 - Issue #8040: added a version switcher to the documentation.  Patch by
   Yury Selivanov.