diff options
author | Gregory P. Smith <greg@krypto.org> | 2013-02-01 21:02:59 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2013-02-01 21:02:59 (GMT) |
commit | a998ad013591407162c633af938994e18ba3be39 (patch) | |
tree | 172f67efbbb91cecedc6d944346cd4b713b305c0 /Modules | |
parent | 608cc451c7798812826f886089f700330bde8e1c (diff) | |
download | cpython-a998ad013591407162c633af938994e18ba3be39.zip cpython-a998ad013591407162c633af938994e18ba3be39.tar.gz cpython-a998ad013591407162c633af938994e18ba3be39.tar.bz2 |
Additional fix for Issue #12268: The io module file object writelines() methods
no longer abort early when one of its write system calls is interrupted (EINTR).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_io/iobase.c | 5 | ||||
-rw-r--r-- | Modules/_io/textio.c | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index 04caea4..063ba2e 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -660,7 +660,10 @@ iobase_writelines(PyObject *self, PyObject *args) 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 index d2e92fa..c9913d4 100644 --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -1213,8 +1213,11 @@ _textiowrapper_writeflush(textio *self) 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; |