[pypy-svn] r31036 - pypy/dist/pypy/module/bz2

rhymes at codespeak.net rhymes at codespeak.net
Sat Aug 5 20:25:18 CEST 2006


Author: rhymes
Date: Sat Aug  5 20:25:15 2006
New Revision: 31036

Modified:
   pypy/dist/pypy/module/bz2/interp_bz2.py
Log:
catch the exception dude!

Modified: pypy/dist/pypy/module/bz2/interp_bz2.py
==============================================================================
--- pypy/dist/pypy/module/bz2/interp_bz2.py	(original)
+++ pypy/dist/pypy/module/bz2/interp_bz2.py	Sat Aug  5 20:25:15 2006
@@ -364,8 +364,9 @@
         mode = ('wb', 'rb')[mode_char == 'r']
         
         # open the file and set the buffer
-        f = pythonapi.PyFile_FromString(name, mode)
-        if not f:
+        try:
+            f = pythonapi.PyFile_FromString(name, mode)
+        except IOError:
             raise OperationError(self.space.w_IOError,
                 self.space.wrap("cannot open file %s" % name))
         pythonapi.PyFile_SetBufSize(f, buffering)



More information about the Pypy-commit mailing list