summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-11-11 12:52:10 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-11-11 12:52:10 (GMT)
commit04050b80b1d467737aa8c0192877fcc4cf72adc8 (patch)
treee0d9bbe0b77b2665ba10ba2096b564862f3a7b6e
parentc3197254acdbf2d9b8a86b68441b9b07fc85d0a4 (diff)
downloadcpython-04050b80b1d467737aa8c0192877fcc4cf72adc8.zip
cpython-04050b80b1d467737aa8c0192877fcc4cf72adc8.tar.gz
cpython-04050b80b1d467737aa8c0192877fcc4cf72adc8.tar.bz2
Issue #15677: Document that zlib and gzip accept a compression level of 0 to mean 'no compression'.
Patch by Brian Brazil.
-rw-r--r--Doc/library/gzip.rst7
-rw-r--r--Doc/library/zlib.rst11
-rw-r--r--Lib/gzip.py5
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS3
5 files changed, 17 insertions, 10 deletions
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst
index 470de08..465510f 100644
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -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
diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst
index bd08f7f..a3a27c5 100644
--- a/Doc/library/zlib.rst
+++ b/Doc/library/zlib.rst
@@ -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])
diff --git a/Lib/gzip.py b/Lib/gzip.py
index 92a7eea..a613bae 100644
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -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
diff --git a/Misc/ACKS b/Misc/ACKS
index 01bc45e..3604dd0 100644
--- 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
diff --git a/Misc/NEWS b/Misc/NEWS
index 96c8614..d5a048e 100644
--- 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.