Commit 9cefe905 authored by Robert Bradshaw's avatar Robert Bradshaw

Get rid of unraisable warnings in the refnanny.

parent 521185b4
...@@ -91,13 +91,17 @@ cdef void GOTREF(PyObject* ctx, PyObject* p_obj, int lineno): ...@@ -91,13 +91,17 @@ cdef void GOTREF(PyObject* ctx, PyObject* p_obj, int lineno):
if ctx == NULL: return if ctx == NULL: return
cdef PyObject* type = NULL, *value = NULL, *tb = NULL cdef PyObject* type = NULL, *value = NULL, *tb = NULL
PyErr_Fetch(&type, &value, &tb) PyErr_Fetch(&type, &value, &tb)
try:
try: try:
if p_obj is NULL: if p_obj is NULL:
(<object>ctx).regref(None, lineno, True) (<object>ctx).regref(None, lineno, True)
else: else:
(<object>ctx).regref(<object>p_obj, lineno, False) (<object>ctx).regref(<object>p_obj, lineno, False)
except Exception, e: except object, e:
report_unraisable(e) report_unraisable(e)
except:
# __Pyx_GetException may itself raise errors
pass
PyErr_Restore(type, value, tb) PyErr_Restore(type, value, tb)
cdef int GIVEREF_and_report(PyObject* ctx, PyObject* p_obj, int lineno): cdef int GIVEREF_and_report(PyObject* ctx, PyObject* p_obj, int lineno):
...@@ -105,13 +109,17 @@ cdef int GIVEREF_and_report(PyObject* ctx, PyObject* p_obj, int lineno): ...@@ -105,13 +109,17 @@ cdef int GIVEREF_and_report(PyObject* ctx, PyObject* p_obj, int lineno):
cdef PyObject* type = NULL, *value = NULL, *tb = NULL cdef PyObject* type = NULL, *value = NULL, *tb = NULL
cdef bint decref_ok = False cdef bint decref_ok = False
PyErr_Fetch(&type, &value, &tb) PyErr_Fetch(&type, &value, &tb)
try:
try: try:
if p_obj is NULL: if p_obj is NULL:
decref_ok = (<object>ctx).delref(None, lineno, True) decref_ok = (<object>ctx).delref(None, lineno, True)
else: else:
decref_ok = (<object>ctx).delref(<object>p_obj, lineno, False) decref_ok = (<object>ctx).delref(<object>p_obj, lineno, False)
except Exception, e: except object, e:
report_unraisable(e) report_unraisable(e)
except:
# __Pyx_GetException may itself raise errors
pass
PyErr_Restore(type, value, tb) PyErr_Restore(type, value, tb)
return decref_ok return decref_ok
...@@ -131,6 +139,7 @@ cdef void FinishContext(PyObject** ctx): ...@@ -131,6 +139,7 @@ cdef void FinishContext(PyObject** ctx):
cdef PyObject* type = NULL, *value = NULL, *tb = NULL cdef PyObject* type = NULL, *value = NULL, *tb = NULL
cdef object errors = None cdef object errors = None
PyErr_Fetch(&type, &value, &tb) PyErr_Fetch(&type, &value, &tb)
try:
try: try:
errors = (<object>ctx[0]).end() errors = (<object>ctx[0]).end()
pos = (<object>ctx[0]).filename, (<object>ctx[0]).name pos = (<object>ctx[0]).filename, (<object>ctx[0]).name
...@@ -139,6 +148,9 @@ cdef void FinishContext(PyObject** ctx): ...@@ -139,6 +148,9 @@ cdef void FinishContext(PyObject** ctx):
print errors print errors
except Exception, e: except Exception, e:
report_unraisable(e) report_unraisable(e)
except:
# __Pyx_GetException may itself raise errors
pass
Py_DECREF(<object>ctx[0]) Py_DECREF(<object>ctx[0])
ctx[0] = NULL ctx[0] = NULL
PyErr_Restore(type, value, tb) PyErr_Restore(type, value, tb)
......
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