summaryrefslogtreecommitdiffstats
path: root/Modules/_io/textio.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r--Modules/_io/textio.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 48e0c66..65c8d8d 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2480,15 +2480,8 @@ textiowrapper_close(textio *self, PyObject *args)
res = PyObject_CallMethod(self->buffer, "close", NULL);
if (exc != NULL) {
- if (res != NULL) {
- Py_CLEAR(res);
- PyErr_Restore(exc, val, tb);
- }
- else {
- Py_DECREF(exc);
- Py_XDECREF(val);
- Py_XDECREF(tb);
- }
+ _PyErr_ReplaceException(exc, val, tb);
+ Py_CLEAR(res);
}
return res;
}