diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-21 19:09:32 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-21 19:09:32 (GMT) |
commit | b46b9d59ef1e2433b00c6d3fee077e57644c84bb (patch) | |
tree | 2dfd270e8dd0669abfb2b0e87de3e12a63971000 /Modules | |
parent | 522180a60bf4ae10615c0acd3a9906d42538768c (diff) | |
download | cpython-b46b9d59ef1e2433b00c6d3fee077e57644c84bb.zip cpython-b46b9d59ef1e2433b00c6d3fee077e57644c84bb.tar.gz cpython-b46b9d59ef1e2433b00c6d3fee077e57644c84bb.tar.bz2 |
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 4678da9..615e644 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1665,6 +1665,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) { @@ -1802,6 +1807,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); |