Author: Armin Rigo <ar...@tunes.org>
Branch: py3.6
Changeset: r98533:ce8858de481f
Date: 2020-01-14 15:29 +0100
http://bitbucket.org/pypy/pypy/changeset/ce8858de481f/

Log:    Use a new _raise_error_always() function call for places that are
        missing loops to retry. Maybe we should add these loops, too; I
        didn't check

diff --git a/pypy/module/fcntl/interp_fcntl.py 
b/pypy/module/fcntl/interp_fcntl.py
--- a/pypy/module/fcntl/interp_fcntl.py
+++ b/pypy/module/fcntl/interp_fcntl.py
@@ -81,8 +81,14 @@
     # wrap_oserror(..., eintr_retry=True) raises an OSError or returns None
     # when appropriate
     errno = rposix.get_saved_errno()
-    return wrap_oserror(space, OSError(errno, funcname),
-                        exception_name = 'w_IOError', eintr_retry=True)
+    wrap_oserror(space, OSError(errno, funcname),
+                 exception_name = 'w_IOError', eintr_retry=True)
+
+def _raise_error_always(space, funcname):
+    # this variant never returns normally, and doesn't retry if it gets EINTR.
+    errno = rposix.get_saved_errno()
+    raise wrap_oserror(space, OSError(errno, funcname),
+                       exception_name = 'w_IOError', eintr_retry=False)
 
 @unwrap_spec(op=int, w_arg=WrappedDefault(0))
 def fcntl(space, w_fd, op, w_arg):
@@ -231,7 +237,7 @@
                               rffi.cast(rffi.VOIDP, ll_arg), len(arg))
                 rv = ioctl_str(fd, op, buf.raw)
                 if rv < 0:
-                    _raise_error_maybe(space, "ioctl")
+                    _raise_error_always(space, "ioctl")
                 arg = rffi.charpsize2str(buf.raw, len(arg))
                 if mutate_flag != 0:
                     rwbuffer.setslice(0, arg)
@@ -259,7 +265,7 @@
                               rffi.cast(rffi.VOIDP, ll_arg), len(arg))
                 rv = ioctl_str(fd, op, buf.raw)
                 if rv < 0:
-                    _raise_error_maybe(space, "ioctl")
+                    _raise_error_always(space, "ioctl")
                 arg = rffi.charpsize2str(buf.raw, len(arg))
             return space.newbytes(arg)
         finally:
@@ -269,5 +275,5 @@
     intarg = rffi.cast(rffi.INT, intarg)   # C long => C int
     rv = ioctl_int(fd, op, intarg)
     if rv < 0:
-        _raise_error_maybe(space, "ioctl")
+        _raise_error_always(space, "ioctl")
     return space.newint(rv)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to