diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index 5188ecefb98221..3c34f5bc4d0ea1 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -2154,15 +2154,13 @@ and :c:data:`PyType_Type` effectively act as defaults.) static void local_finalize(PyObject *self) { - PyObject *error_type, *error_value, *error_traceback; - /* Save the current exception, if any. */ - PyErr_Fetch(&error_type, &error_value, &error_traceback); + PyObject *exc = PyErr_GetRaisedException(); /* ... */ /* Restore the saved exception. */ - PyErr_Restore(error_type, error_value, error_traceback); + PyErr_SetRaisedException(exc); } **Inheritance:**