(original) (raw)
changeset: 85414:79ce25c70795 user: Victor Stinner vstinner@wyplay.com date: Mon Aug 26 13:49:06 2013 +0200 files: Objects/object.c description: Issue #18408: _PyObject_Dump() now saves/restores the current exception So it can be called even if an exception was raised diff -r 6cb3ae431bef -r 79ce25c70795 Objects/object.c --- a/Objects/object.c Mon Aug 26 14:01:29 2013 +0300 +++ b/Objects/object.c Mon Aug 26 13:49:06 2013 +0200 @@ -406,11 +406,17 @@ #ifdef WITH_THREAD PyGILState_STATE gil; #endif + PyObject *error_type, *error_value, *error_traceback; + fprintf(stderr, "object : "); #ifdef WITH_THREAD gil = PyGILState_Ensure(); #endif + + PyErr_Fetch(&error_type, &error_value, &error_traceback); (void)PyObject_Print(op, stderr, 0); + PyErr_Restore(error_type, error_value, error_traceback); + #ifdef WITH_THREAD PyGILState_Release(gil); #endif /vstinner@wyplay.com