Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modules/_io/textio.c
  • Loading branch information
iritkatriel committed Feb 24, 2023
commit 05b28330a548343fbeb86c2cf9cf5a7df9ce1394
23 changes: 13 additions & 10 deletions Modules/_io/textio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2827,11 +2827,10 @@ _io_TextIOWrapper_tell_impl(textio *self)

fail:
if (saved_state) {
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
PyObject *exc = PyErr_GetRaisedException();
res = PyObject_CallMethodOneArg(
self->decoder, &_Py_ID(setstate), saved_state);
_PyErr_ChainExceptions(type, value, traceback);
_PyErr_ChainExceptions1(exc);
Py_DECREF(saved_state);
Py_XDECREF(res);
}
Expand Down Expand Up @@ -3028,24 +3027,28 @@ _io_TextIOWrapper_close_impl(textio *self)
Py_RETURN_NONE; /* stream already closed */
}
else {
PyObject *exc = NULL, *val, *tb;
PyObject *exc = NULL;
if (self->finalizing) {
res = PyObject_CallMethodOneArg(self->buffer, &_Py_ID(_dealloc_warn),
(PyObject *)self);
if (res)
if (res) {
Py_DECREF(res);
else
}
else {
PyErr_Clear();
}
}
res = PyObject_CallMethodNoArgs((PyObject *)self, &_Py_ID(flush));
if (res == NULL)
PyErr_Fetch(&exc, &val, &tb);
else
if (res == NULL) {
exc = PyErr_GetRaisedException();
}
else {
Py_DECREF(res);
}

res = PyObject_CallMethodNoArgs(self->buffer, &_Py_ID(close));
if (exc != NULL) {
_PyErr_ChainExceptions(exc, val, tb);
_PyErr_ChainExceptions1(exc);
Py_CLEAR(res);
}
return res;
Expand Down