# needs to handle exceptions or by code that needs to save and
# restore the error indicator temporarily.
- void PyErr_Restore(object type, object value, object traceback)
+ void PyErr_Restore(PyObject* type, PyObject* value, PyObject* traceback)
# Set the error indicator from the three objects. If the error
# indicator is already set, it is cleared first. If the objects
# are NULL, the error indicator is cleared. Do not pass a NULL
else:
return None
-cpdef report_unraisable(e):
+cdef void report_unraisable(object e):
try:
print "refnanny raised an exception: %s" % e
except:
result = <PyObject*>ctx
except Exception, e:
report_unraisable(e)
- PyErr_Restore(<object>type, <object>value, <object>tb)
+ PyErr_Restore(type, value, tb)
return result
cdef void GOTREF(PyObject* ctx, PyObject* p_obj, int lineno):
(<object>ctx).regref(<object>p_obj, lineno, False)
except Exception, e:
report_unraisable(e)
- PyErr_Restore(<object>type, <object>value, <object>tb)
+ PyErr_Restore(type, value, tb)
cdef int GIVEREF_and_report(PyObject* ctx, PyObject* p_obj, int lineno):
if ctx == NULL: return 1
decref_ok = (<object>ctx).delref(<object>p_obj, lineno, False)
except Exception, e:
report_unraisable(e)
- PyErr_Restore(<object>type, <object>value, <object>tb)
+ PyErr_Restore(type, value, tb)
return decref_ok
cdef void GIVEREF(PyObject* ctx, PyObject* p_obj, int lineno):
report_unraisable(e)
Py_DECREF(<object>ctx[0])
ctx[0] = NULL
- PyErr_Restore(<object>type, <object>value, <object>tb)
+ PyErr_Restore(type, value, tb)
cdef extern from "Python.h":
object PyCObject_FromVoidPtr(void*, void (*)(void*))