[Python-checkins] cpython (merge 3.3 -> default): Additional fix for issue #12268: The io module file object write methods no

gregory.p.smith python-checkins at python.org
Fri Feb 1 22:12:34 CET 2013


http://hg.python.org/cpython/rev/8f72519fd0e9
changeset:   81881:8f72519fd0e9
parent:      81873:249e0b47b686
parent:      81880:29e3aa7f2f4b
user:        Gregory P. Smith <greg at krypto.org>
date:        Fri Feb 01 13:10:33 2013 -0800
summary:
  Additional fix for issue #12268: The io module file object write methods no
longer abort early when a write system call is interrupted (EINTR).

files:
  Misc/NEWS            |  6 ++++++
  Modules/_io/iobase.c |  5 ++++-
  Modules/_io/textio.c |  7 +++++--
  3 files changed, 15 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -715,6 +715,12 @@
   `sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common
   code was moved from _hashopenssl.c to hashlib.h.
 
+Extension Modules
+-----------------
+
+- Issue #12268: The io module file object write methods no longer abort early
+  when one of its write system calls is interrupted (EINTR).
+
 Tests
 -----
 
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -669,7 +669,10 @@
                 break; /* Stop Iteration */
         }
 
-        res = PyObject_CallMethodObjArgs(self, _PyIO_str_write, line, NULL);
+        res = NULL;
+        do {
+            res = PyObject_CallMethodObjArgs(self, _PyIO_str_write, line, NULL);
+        } while (res == NULL && _PyIO_trap_eintr());
         Py_DECREF(line);
         if (res == NULL) {
             Py_DECREF(iter);
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1247,8 +1247,11 @@
     Py_DECREF(pending);
     if (b == NULL)
         return -1;
-    ret = PyObject_CallMethodObjArgs(self->buffer,
-                                     _PyIO_str_write, b, NULL);
+    ret = NULL;
+    do {
+        ret = PyObject_CallMethodObjArgs(self->buffer,
+                                         _PyIO_str_write, b, NULL);
+    } while (ret == NULL && _PyIO_trap_eintr());
     Py_DECREF(b);
     if (ret == NULL)
         return -1;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list