Skip to content

Commit 15e3964

Browse files
committed
Modules/_io/winconsoleio.c
1 parent 05b2833 commit 15e3964

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Modules/_io/winconsoleio.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,24 @@ _io__WindowsConsoleIO_close_impl(winconsoleio *self)
192192
/*[clinic end generated code: output=27ef95b66c29057b input=68c4e5754f8136c2]*/
193193
{
194194
PyObject *res;
195-
PyObject *exc, *val, *tb;
195+
PyObject *exc;
196196
int rc;
197197
res = PyObject_CallMethodOneArg((PyObject*)&PyRawIOBase_Type,
198198
&_Py_ID(close), (PyObject*)self);
199199
if (!self->closefd) {
200200
self->fd = -1;
201201
return res;
202202
}
203-
if (res == NULL)
204-
PyErr_Fetch(&exc, &val, &tb);
203+
if (res == NULL) {
204+
exc = PyErr_GetRaisedException();
205+
}
205206
rc = internal_close(self);
206-
if (res == NULL)
207-
_PyErr_ChainExceptions(exc, val, tb);
208-
if (rc < 0)
207+
if (res == NULL) {
208+
_PyErr_ChainExceptions1(exc);
209+
}
210+
if (rc < 0) {
209211
Py_CLEAR(res);
212+
}
210213
return res;
211214
}
212215

0 commit comments

Comments
 (0)