summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorLars Gustäbel <lars@gustaebel.de>2009-03-22 20:34:29 (GMT)
committerLars Gustäbel <lars@gustaebel.de>2009-03-22 20:34:29 (GMT)
commit42e0091208254a8af8e7a96c94559c000370a3b7 (patch)
treec21cd0243e0c55b497b89b1212df5f987d788d64 /Lib/tarfile.py
parentdb08306bc2f170921e58f0edfd158bae05926c18 (diff)
downloadcpython-42e0091208254a8af8e7a96c94559c000370a3b7.zip
cpython-42e0091208254a8af8e7a96c94559c000370a3b7.tar.gz
cpython-42e0091208254a8af8e7a96c94559c000370a3b7.tar.bz2
Merged revisions 70523 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70523 | lars.gustaebel | 2009-03-22 21:09:33 +0100 (Sun, 22 Mar 2009) | 5 lines Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop forever on incomplete input. That caused tarfile.open() to hang when used with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or partial bzip2 compressed data. ........
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 4264da3..3a3d2c9 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -639,12 +639,11 @@ class _BZ2Proxy(object):
def read(self, size):
x = len(self.buf)
while x < size:
- try:
- raw = self.fileobj.read(self.blocksize)
- data = self.bz2obj.decompress(raw)
- self.buf += data
- except EOFError:
+ raw = self.fileobj.read(self.blocksize)
+ if not raw:
break
+ data = self.bz2obj.decompress(raw)
+ self.buf += data
x += len(data)
buf = self.buf[:size]