View Single Post
  #4 (permalink)  
Old 08-20-2005
ckohnert ckohnert is offline
Registered User
 
 
Join Date: Aug 2005
Posts: 9
After looking at the python source, it looks like the proper way to do this is:

Code:
if( <print traceback> )
{
        Py_XINCREF(t);
        Py_XINCREF(val);
        Py_XINCREF(tb);
        PyErr_Restore(t, val, tb);
        PyErr_PrintEx(0);
}
The difference is in the last call which tells it not to 'save' the current exception values when printing them, thus allowing the ref counts to clear normally. Been using this for better part of a day now with no trouble.
Reply With Quote