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

benjamin at codespeak.net benjamin at codespeak.net
Sun Jul 11 23:40:52 CEST 2010


Author: benjamin
Date: Sun Jul 11 23:40:51 2010
New Revision: 76110

Modified:
   pypy/branch/fast-forward/pypy/module/posix/interp_posix.py
Log:
don't translate IOError case

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	Sun Jul 11 23:40:51 2010
@@ -1,5 +1,5 @@
 from pypy.interpreter.gateway import ObjSpace, W_Root, NoneNotWrapped
-from pypy.rlib import rposix
+from pypy.rlib import rposix, objectmodel
 from pypy.rlib.rarithmetic import r_longlong
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.interpreter.error import OperationError, wrap_oserror
@@ -84,11 +84,13 @@
     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)
+        if not objectmodel.we_are_translated():
+            # 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)
+        raise AssertionError
     except OSError, e: 
         raise wrap_oserror(space, e) 
 ftruncate.unwrap_spec = [ObjSpace, "c_int", r_longlong]



More information about the Pypy-commit mailing list