mirror of
https://github.com/python/cpython
synced 2024-09-15 22:10:19 +00:00
bpo-45475: Revert __iter__
optimization for GzipFile, BZ2File, and LZMAFile. (GH-29016)
This reverts commit d2a8e69c2c
.
This commit is contained in:
parent
c029567530
commit
0a4c82ddd3
|
@ -197,10 +197,6 @@ def readline(self, size=-1):
|
||||||
self._check_can_read()
|
self._check_can_read()
|
||||||
return self._buffer.readline(size)
|
return self._buffer.readline(size)
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
self._check_can_read()
|
|
||||||
return self._buffer.__iter__()
|
|
||||||
|
|
||||||
def readlines(self, size=-1):
|
def readlines(self, size=-1):
|
||||||
"""Read a list of lines of uncompressed bytes from the file.
|
"""Read a list of lines of uncompressed bytes from the file.
|
||||||
|
|
||||||
|
|
|
@ -398,10 +398,6 @@ def readline(self, size=-1):
|
||||||
self._check_not_closed()
|
self._check_not_closed()
|
||||||
return self._buffer.readline(size)
|
return self._buffer.readline(size)
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
self._check_not_closed()
|
|
||||||
return self._buffer.__iter__()
|
|
||||||
|
|
||||||
|
|
||||||
def _read_exact(fp, n):
|
def _read_exact(fp, n):
|
||||||
'''Read exactly *n* bytes from `fp`
|
'''Read exactly *n* bytes from `fp`
|
||||||
|
|
|
@ -221,10 +221,6 @@ def readline(self, size=-1):
|
||||||
self._check_can_read()
|
self._check_can_read()
|
||||||
return self._buffer.readline(size)
|
return self._buffer.readline(size)
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
self._check_can_read()
|
|
||||||
return self._buffer.__iter__()
|
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
"""Write a bytes object to the file.
|
"""Write a bytes object to the file.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
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.
|
Loading…
Reference in a new issue