# HG changeset patch # Parent 04162e06323f369c1468d2009b4d8ba6805a6b0c diff -r 04162e06323f Lib/_compression.py --- a/Lib/_compression.py Sun May 31 09:16:13 2015 +0300 +++ b/Lib/_compression.py Mon Jun 01 12:29:00 2015 +0000 @@ -60,6 +60,11 @@ self._decompressor = None return super().close() + @property + def closed(self): + # This is polled for every operation; default implemenation too slow + return self._decompressor is None + def seekable(self): return self._fp.seekable() diff -r 04162e06323f Lib/gzip.py --- a/Lib/gzip.py Sun May 31 09:16:13 2015 +0300 +++ b/Lib/gzip.py Mon Jun 01 12:29:00 2015 +0000 @@ -371,6 +371,11 @@ self._check_not_closed() return self._buffer.readline(size) + def __iter__(self): + # Shortcut to bypass the readline() method above + self._check_not_closed() + return iter(self._buffer) + class _GzipReader(_compression.DecompressReader): def __init__(self, fp): diff -r 04162e06323f Lib/lzma.py --- a/Lib/lzma.py Sun May 31 09:16:13 2015 +0300 +++ b/Lib/lzma.py Mon Jun 01 12:29:00 2015 +0000 @@ -219,6 +219,11 @@ self._check_can_read() return self._buffer.readline(size) + def __iter__(self): + # Shortcut to bypass the readline() method above + self._check_can_read() + return iter(self._buffer) + def write(self, data): """Write a bytes object to the file.