mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
Issue #21802: The reader in BufferedRWPair now is closed even when closing
writer failed in BufferedRWPair.close().
This commit is contained in:
parent
8ffe917cee
commit
7665be6087
4 changed files with 64 additions and 6 deletions
|
|
@ -2365,12 +2365,18 @@ bufferedrwpair_writable(rwpair *self, PyObject *args)
|
|||
static PyObject *
|
||||
bufferedrwpair_close(rwpair *self, PyObject *args)
|
||||
{
|
||||
PyObject *exc = NULL, *val, *tb;
|
||||
PyObject *ret = _forward_call(self->writer, &PyId_close, args);
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
Py_DECREF(ret);
|
||||
|
||||
return _forward_call(self->reader, &PyId_close, args);
|
||||
PyErr_Fetch(&exc, &val, &tb);
|
||||
else
|
||||
Py_DECREF(ret);
|
||||
ret = _forward_call(self->reader, &PyId_close, args);
|
||||
if (exc != NULL) {
|
||||
_PyErr_ChainExceptions(exc, val, tb);
|
||||
Py_CLEAR(ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue