diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst index 191f3690bccd5c..f74294a0fd7e16 100644 --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -2153,15 +2153,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:**