[Python-checkins] cpython (merge 3.2 -> 3.3): 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:32 CET 2013


http://hg.python.org/cpython/rev/30fc620e240e
changeset:   81879:30fc620e240e
branch:      3.3
parent:      81872:483488a1dec5
parent:      81876:2fd669aa4abc
user:        Gregory P. Smith <greg at krypto.org>
date:        Fri Feb 01 13:08:23 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
@@ -506,6 +506,12 @@
 - Issue #15906: Fix a regression in `argparse` caused by the preceding change,
   when ``action='append'``, ``type='str'`` and ``default=[]``.
 
+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