[Python-checkins] cpython (3.3): #18430: Document that peek() may change the position of the underlying file for

nadeem.vawda python-checkins at python.org
Sun Dec 8 19:50:27 CET 2013


http://hg.python.org/cpython/rev/5ca6e8af0aab
changeset:   87836:5ca6e8af0aab
branch:      3.3
parent:      87834:910b1cb5176c
user:        Nadeem Vawda <nadeem.vawda at gmail.com>
date:        Sun Dec 08 19:47:22 2013 +0100
summary:
  #18430: Document that peek() may change the position of the underlying file for
the BZ2File, GzipFile and LZMAFile classes.

files:
  Doc/library/bz2.rst  |  5 +++++
  Doc/library/gzip.rst |  5 +++++
  Doc/library/lzma.rst |  5 +++++
  3 files changed, 15 insertions(+), 0 deletions(-)


diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -91,6 +91,11 @@
       byte of data will be returned (unless at EOF). The exact number of bytes
       returned is unspecified.
 
+      .. note:: While calling :meth:`peek` does not change the file position of
+         the :class:`BZ2File`, it may change the position of the underlying file
+         object (e.g. if the :class:`BZ2File` was constructed by passing a file
+         object for *filename*).
+
       .. versionadded:: 3.3
 
    .. versionchanged:: 3.1
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -113,6 +113,11 @@
       the call.  The number of bytes returned may be more or less than
       requested.
 
+      .. note:: While calling :meth:`peek` does not change the file position of
+         the :class:`GzipFile`, it may change the position of the underlying
+         file object (e.g. if the :class:`GzipFile` was constructed with the
+         *fileobj* parameter).
+
       .. versionadded:: 3.2
 
    .. versionchanged:: 3.1
diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst
--- a/Doc/library/lzma.rst
+++ b/Doc/library/lzma.rst
@@ -98,6 +98,11 @@
       byte of data will be returned, unless EOF has been reached. The exact
       number of bytes returned is unspecified (the *size* argument is ignored).
 
+      .. note:: While calling :meth:`peek` does not change the file position of
+         the :class:`LZMAFile`, it may change the position of the underlying
+         file object (e.g. if the :class:`LZMAFile` was constructed by passing a
+         file object for *filename*).
+
 
 Compressing and decompressing data in memory
 --------------------------------------------

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list