Author: Armin Rigo <[email protected]>
Branch:
Changeset: r58953:f9fc91bb6193
Date: 2012-11-16 17:01 +0100
http://bitbucket.org/pypy/pypy/changeset/f9fc91bb6193/
Log: Correct this "assert": it can really fail, e.g. when trying to open
/dev/null.
diff --git a/pypy/rlib/rzipfile.py b/pypy/rlib/rzipfile.py
--- a/pypy/rlib/rzipfile.py
+++ b/pypy/rlib/rzipfile.py
@@ -90,7 +90,8 @@
filesize = fpin.tell() + 22 # Get file size
data = fpin.readall()
start = len(data)-2
- assert start > 0
+ if start <= 0:
+ return # Error, return None
if data[0:4] == stringEndArchive and data[start:] == "\000\000":
endrec = runpack(structEndArchive, data)
return EndRecStruct(endrec, "", filesize - 22)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit