@@ -4397,10 +4397,9 @@ static void
4397
4397
type_dealloc_common (PyTypeObject * type )
4398
4398
{
4399
4399
if (type -> tp_bases != NULL ) {
4400
- PyObject * tp , * val , * tb ;
4401
- PyErr_Fetch (& tp , & val , & tb );
4400
+ PyObject * exc = PyErr_GetRaisedException ();
4402
4401
remove_all_subclasses (type , type -> tp_bases );
4403
- PyErr_Restore ( tp , val , tb );
4402
+ PyErr_SetRaisedException ( exc );
4404
4403
}
4405
4404
}
4406
4405
@@ -8445,10 +8444,9 @@ slot_tp_finalize(PyObject *self)
8445
8444
{
8446
8445
int unbound ;
8447
8446
PyObject * del , * res ;
8448
- PyObject * error_type , * error_value , * error_traceback ;
8449
8447
8450
8448
/* Save the current exception, if any. */
8451
- PyErr_Fetch ( & error_type , & error_value , & error_traceback );
8449
+ PyObject * exc = PyErr_GetRaisedException ( );
8452
8450
8453
8451
/* Execute __del__ method, if any. */
8454
8452
del = lookup_maybe_method (self , & _Py_ID (__del__ ), & unbound );
@@ -8462,7 +8460,7 @@ slot_tp_finalize(PyObject *self)
8462
8460
}
8463
8461
8464
8462
/* Restore the saved exception. */
8465
- PyErr_Restore ( error_type , error_value , error_traceback );
8463
+ PyErr_SetRaisedException ( exc );
8466
8464
}
8467
8465
8468
8466
static PyObject *
0 commit comments