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

Get rid of unraisable warnings in the refnanny.

parent 521185b4
...@@ -92,12 +92,16 @@ cdef void GOTREF(PyObject* ctx, PyObject* p_obj, int lineno): ...@@ -92,12 +92,16 @@ cdef void GOTREF(PyObject* ctx, PyObject* p_obj, int lineno):
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:
if p_obj is NULL: try:
(<object>ctx).regref(None, lineno, True) if p_obj is NULL:
else: (<object>ctx).regref(None, lineno, True)
(<object>ctx).regref(<object>p_obj, lineno, False) else:
except Exception, e: (<object>ctx).regref(<object>p_obj, lineno, False)
report_unraisable(e) except object, 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):
...@@ -106,12 +110,16 @@ cdef int GIVEREF_and_report(PyObject* ctx, PyObject* p_obj, int lineno): ...@@ -106,12 +110,16 @@ cdef int GIVEREF_and_report(PyObject* ctx, PyObject* p_obj, int lineno):
cdef bint decref_ok = False cdef bint decref_ok = False
PyErr_Fetch(&type, &value, &tb) PyErr_Fetch(&type, &value, &tb)
try: try:
if p_obj is NULL: try:
decref_ok = (<object>ctx).delref(None, lineno, True) if p_obj is NULL:
else: decref_ok = (<object>ctx).delref(None, lineno, True)
decref_ok = (<object>ctx).delref(<object>p_obj, lineno, False) else:
except Exception, e: decref_ok = (<object>ctx).delref(<object>p_obj, lineno, False)
report_unraisable(e) except object, 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
...@@ -132,13 +140,17 @@ cdef void FinishContext(PyObject** ctx): ...@@ -132,13 +140,17 @@ cdef void FinishContext(PyObject** ctx):
cdef object errors = None cdef object errors = None
PyErr_Fetch(&type, &value, &tb) PyErr_Fetch(&type, &value, &tb)
try: try:
errors = (<object>ctx[0]).end() try:
pos = (<object>ctx[0]).filename, (<object>ctx[0]).name errors = (<object>ctx[0]).end()
if errors: pos = (<object>ctx[0]).filename, (<object>ctx[0]).name
print u"%s: %s()" % pos if errors:
print errors print u"%s: %s()" % pos
except Exception, e: print errors
report_unraisable(e) except Exception, 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