[pypy-svn] r39830 - pypy/dist/pypy/module/_file

ac at codespeak.net ac at codespeak.net
Sat Mar 3 18:05:06 CET 2007


Author: ac
Date: Sat Mar  3 18:05:04 2007
New Revision: 39830

Modified:
   pypy/dist/pypy/module/_file/interp_file.py
Log:
issue137 in-progress

(asigfrid arre)
This checks for EINTR when calling methods on stream objects. This
solves using Ctrl-C at the prompt. We may want to make checks in more
places.



Modified: pypy/dist/pypy/module/_file/interp_file.py
==============================================================================
--- pypy/dist/pypy/module/_file/interp_file.py	(original)
+++ pypy/dist/pypy/module/_file/interp_file.py	Sat Mar  3 18:05:04 2007
@@ -1,11 +1,13 @@
 import py
 from pypy.rlib import streamio
+from errno import EINTR
 
 from pypy.interpreter.error import OperationError
 from pypy.interpreter.gateway import ObjSpace, W_Root, NoneNotWrapped, applevel
 from pypy.interpreter.baseobjspace import Wrappable
 from pypy.interpreter.typedef import TypeDef
 from pypy.interpreter.gateway import interp2app
+from pypy.interpreter.miscutils import Action
 
 import os
 
@@ -13,6 +15,14 @@
 def wrap_oserror_as_ioerror(space, e):
     assert isinstance(e, OSError)
     errno = e.errno
+    if errno == EINTR:
+        # A signal was sent to the process and interupted
+        # a systemcall. We want to trigger running of
+        # any installed interrupt handlers.
+        # XXX: is there a better way?
+        ec = space.getexecutioncontext()
+        Action.perform_actions(space.pending_actions)
+        Action.perform_actions(ec.pending_actions)
     try:
         msg = os.strerror(errno)
     except ValueError:



More information about the Pypy-commit mailing list