Skip to content

Commit 04985db

Browse files
committed
Modules/_testcapimodule.c
1 parent a160b6a commit 04985db

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Modules/_testcapimodule.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -1611,19 +1611,18 @@ static void
16111611
slot_tp_del(PyObject *self)
16121612
{
16131613
PyObject *del, *res;
1614-
PyObject *error_type, *error_value, *error_traceback;
16151614

16161615
/* Temporarily resurrect the object. */
16171616
assert(Py_REFCNT(self) == 0);
16181617
Py_SET_REFCNT(self, 1);
16191618

16201619
/* Save the current exception, if any. */
1621-
PyErr_Fetch(&error_type, &error_value, &error_traceback);
1620+
PyObject *exc = PyErr_GetRaisedException();
16221621

16231622
PyObject *tp_del = PyUnicode_InternFromString("__tp_del__");
16241623
if (tp_del == NULL) {
16251624
PyErr_WriteUnraisable(NULL);
1626-
PyErr_Restore(error_type, error_value, error_traceback);
1625+
PyErr_SetRaisedException(exc);
16271626
return;
16281627
}
16291628
/* Execute __del__ method, if any. */
@@ -1638,7 +1637,7 @@ slot_tp_del(PyObject *self)
16381637
}
16391638

16401639
/* Restore the saved exception. */
1641-
PyErr_Restore(error_type, error_value, error_traceback);
1640+
PyErr_SetRaisedException(exc);
16421641

16431642
/* Undo the temporary resurrection; can't use DECREF here, it would
16441643
* cause a recursive call.

0 commit comments

Comments
 (0)