diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-21 19:17:57 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-21 19:17:57 (GMT) |
commit | 16b11de04ef800854a80c6bdcbe999a63fa85b80 (patch) | |
tree | 9761cbabeb21b705b4c50e48d3695eb9f5f2f7bc /Modules | |
parent | 8dcc96c9cc337d8a9be22c49cd78de3646797287 (diff) | |
download | cpython-16b11de04ef800854a80c6bdcbe999a63fa85b80.zip cpython-16b11de04ef800854a80c6bdcbe999a63fa85b80.tar.gz cpython-16b11de04ef800854a80c6bdcbe999a63fa85b80.tar.bz2 |
Merged revisions 84239 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84239 | antoine.pitrou | 2010-08-21 21:09:32 +0200 (sam., 21 août 2010) | 4 lines
Issue #9617: Signals received during a low-level write operation aren't
ignored by the buffered IO layer anymore.
........
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_io/bufferedio.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index d8c1e65..611dc8c 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1661,6 +1661,11 @@ _bufferedwriter_flush_unlocked(buffered *self, int restore_pos) self->write_pos += n; self->raw_pos = self->write_pos; written += Py_SAFE_DOWNCAST(n, Py_off_t, Py_ssize_t); + /* Partial writes can return successfully when interrupted by a + signal (see write(2)). We must run signal handlers before + blocking another time, possibly indefinitely. */ + if (PyErr_CheckSignals() < 0) + goto error; } if (restore_pos) { @@ -1797,6 +1802,11 @@ bufferedwriter_write(buffered *self, PyObject *args) } written += n; remaining -= n; + /* Partial writes can return successfully when interrupted by a + signal (see write(2)). We must run signal handlers before + blocking another time, possibly indefinitely. */ + if (PyErr_CheckSignals() < 0) + goto error; } if (self->readable) _bufferedreader_reset_buf(self); |