mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Issue #9617: Signals received during a low-level write operation aren't
ignored by the buffered IO layer anymore.
This commit is contained in:
parent
522180a60b
commit
b46b9d59ef
3 changed files with 87 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue