[pypy-svn] r75694 - pypy/branch/fast-forward/pypy/module/posix

benjamin at codespeak.net benjamin at codespeak.net
Wed Jun 30 20:14:20 CEST 2010


Author: benjamin
Date: Wed Jun 30 20:14:18 2010
New Revision: 75694

Modified:
   pypy/branch/fast-forward/pypy/module/posix/interp_posix.py
Log:
2.6 is silly and raises an IOError here

Modified: pypy/branch/fast-forward/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/posix/interp_posix.py	(original)
+++ pypy/branch/fast-forward/pypy/module/posix/interp_posix.py	Wed Jun 30 20:14:18 2010
@@ -83,6 +83,12 @@
     """Truncate a file to a specified length."""
     try:
         os.ftruncate(fd, length)
+    except IOError, e:
+        # Python 2.6 raises an IOError here. Let's not repeat that mistake.
+        w_error = space.call_function(space.w_OSError, space.wrap(e.errno),
+                                      space.wrap(e.strerror),
+                                      space.wrap(e.filename))
+        raise OperationError(space.w_OSError, w_error)
     except OSError, e: 
         raise wrap_oserror(space, e) 
 ftruncate.unwrap_spec = [ObjSpace, "c_int", r_longlong]



More information about the Pypy-commit mailing list