self._check_can_read()
return self._buffer.readline(size)
- def __iter__(self):
- self._check_can_read()
- return self._buffer.__iter__()
-
def readlines(self, size=-1):
"""Read a list of lines of uncompressed bytes from the file.
self._check_not_closed()
return self._buffer.readline(size)
- def __iter__(self):
- self._check_not_closed()
- return self._buffer.__iter__()
-
def _read_exact(fp, n):
'''Read exactly *n* bytes from `fp`
self._check_can_read()
return self._buffer.readline(size)
- def __iter__(self):
- self._check_can_read()
- return self._buffer.__iter__()
-
def write(self, data):
"""Write a bytes object to the file.
--- /dev/null
+Reverted optimization of iterating :class:`gzip.GzipFile`,
+:class:`bz2.BZ2File`, and :class:`lzma.LZMAFile` (see bpo-43787) because it
+caused regression when user iterate them without having reference of them.
+Patch by Inada Naoki.