summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2011-08-13 13:22:40 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2011-08-13 13:22:40 (GMT)
commit1c38546e49e3f4bd53c0d470bcaaa9fb2f823401 (patch)
tree855b2bd6790b87283764b7043ed09ea6efa84d38 /Doc
parent74b6abf61f88221c4c859623a75655dcb214e072 (diff)
downloadcpython-1c38546e49e3f4bd53c0d470bcaaa9fb2f823401.zip
cpython-1c38546e49e3f4bd53c0d470bcaaa9fb2f823401.tar.gz
cpython-1c38546e49e3f4bd53c0d470bcaaa9fb2f823401.tar.bz2
Issue #12646: Add an 'eof' attribute to zlib.Decompress.
This will make it easier to detect truncated input streams. Also, make zlib's error messages more consistent.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/zlib.rst20
1 files changed, 12 insertions, 8 deletions
diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst
index a7b8343..54835e7 100644
--- a/Doc/library/zlib.rst
+++ b/Doc/library/zlib.rst
@@ -152,7 +152,7 @@ Compression objects support the following methods:
compress a set of data that share a common initial prefix.
-Decompression objects support the following methods, and two attributes:
+Decompression objects support the following methods and attributes:
.. attribute:: Decompress.unused_data
@@ -162,13 +162,6 @@ Decompression objects support the following methods, and two attributes:
available. If the whole bytestring turned out to contain compressed data, this is
``b""``, an empty bytes object.
- The only way to determine where a bytestring of compressed data ends is by actually
- decompressing it. This means that when compressed data is contained part of a
- larger file, you can only find the end of it by reading data and feeding it
- followed by some non-empty bytestring into a decompression object's
- :meth:`decompress` method until the :attr:`unused_data` attribute is no longer
- empty.
-
.. attribute:: Decompress.unconsumed_tail
@@ -179,6 +172,17 @@ Decompression objects support the following methods, and two attributes:
:meth:`decompress` method call in order to get correct output.
+.. attribute:: Decompress.eof
+
+ A boolean indicating whether the end of the compressed data stream has been
+ reached.
+
+ This makes it possible to distinguish between a properly-formed compressed
+ stream, and an incomplete or truncated one.
+
+ .. versionadded:: 3.3
+
+
.. method:: Decompress.decompress(data[, max_length])
Decompress *data*, returning a bytes object containing the uncompressed data