Kaydet (Commit) e5132102 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #18408: _PyObject_Dump() now saves/restores the current exception

So it can be called even if an exception was raised
üst 0e1e0430
...@@ -406,11 +406,17 @@ _PyObject_Dump(PyObject* op) ...@@ -406,11 +406,17 @@ _PyObject_Dump(PyObject* op)
#ifdef WITH_THREAD #ifdef WITH_THREAD
PyGILState_STATE gil; PyGILState_STATE gil;
#endif #endif
PyObject *error_type, *error_value, *error_traceback;
fprintf(stderr, "object : "); fprintf(stderr, "object : ");
#ifdef WITH_THREAD #ifdef WITH_THREAD
gil = PyGILState_Ensure(); gil = PyGILState_Ensure();
#endif #endif
PyErr_Fetch(&error_type, &error_value, &error_traceback);
(void)PyObject_Print(op, stderr, 0); (void)PyObject_Print(op, stderr, 0);
PyErr_Restore(error_type, error_value, error_traceback);
#ifdef WITH_THREAD #ifdef WITH_THREAD
PyGILState_Release(gil); PyGILState_Release(gil);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment