Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6976104

Browse files
committed
#18430: Document that peek() may change the position of the underlying file for
the BZ2File, GzipFile and LZMAFile classes.
1 parent 3e60a9d commit 6976104

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

Doc/library/bz2.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ All of the classes in this module may safely be accessed from multiple threads.
9191
byte of data will be returned (unless at EOF). The exact number of bytes
9292
returned is unspecified.
9393

94+
.. note:: While calling :meth:`peek` does not change the file position of
95+
the :class:`BZ2File`, it may change the position of the underlying file
96+
object (e.g. if the :class:`BZ2File` was constructed by passing a file
97+
object for *filename*).
98+
9499
.. versionadded:: 3.3
95100

96101
.. versionchanged:: 3.1

Doc/library/gzip.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ The module defines the following items:
113113
the call. The number of bytes returned may be more or less than
114114
requested.
115115

116+
.. note:: While calling :meth:`peek` does not change the file position of
117+
the :class:`GzipFile`, it may change the position of the underlying
118+
file object (e.g. if the :class:`GzipFile` was constructed with the
119+
*fileobj* parameter).
120+
116121
.. versionadded:: 3.2
117122

118123
.. versionchanged:: 3.1

Doc/library/lzma.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ Reading and writing compressed files
9898
byte of data will be returned, unless EOF has been reached. The exact
9999
number of bytes returned is unspecified (the *size* argument is ignored).
100100

101+
.. note:: While calling :meth:`peek` does not change the file position of
102+
the :class:`LZMAFile`, it may change the position of the underlying
103+
file object (e.g. if the :class:`LZMAFile` was constructed by passing a
104+
file object for *filename*).
105+
101106

102107
Compressing and decompressing data in memory
103108
--------------------------------------------

0 commit comments

Comments
 (0)