From: Dag Sverre Seljebotn Date: Sat, 21 Feb 2009 14:42:26 +0000 (+0100) Subject: refnanny: Remove dead exception raising code X-Git-Tag: 0.11.rc~70 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d01287ad768eb62a89fbc29ff946f085cdb40d75;p=cython.git refnanny: Remove dead exception raising code --- diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index fcc05db8..55742e60 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -921,13 +921,8 @@ class CCodeWriter(object): def put_setup_refcount_context(self, name): self.putln('__Pyx_SetupRefcountContext("%s");' % name) - def put_finish_refcount_context(self, pos, name, retval_cname, err_val): - self.putln('if (__Pyx_FinishRefcountContext() == -1) {') - self.putln(self.set_error_info(pos)) - self.putln('__Pyx_AddTraceback("%s");' % name) - if err_val is not None: - self.putln('%s = %s;' % (retval_cname, err_val)) - self.putln('}') + def put_finish_refcount_context(self): + self.putln("__Pyx_FinishRefcountContext();") class PyrexCodeWriter: diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index c44802d9..c28b6593 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1651,8 +1651,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.putln("%s = NULL;" % Naming.retval_cname) code.put_label(code.return_label) # Disabled because of confusion with refcount of global variables -- run ass2cglobal testcase to see - #code.put_finish_refcount_context(self.pos, env.qualified_name, - # Naming.retval_cname, "NULL") + #code.put_finish_refcount_context() code.putln("#if CYTHON_REFNANNY") code.putln("if (__pyx_refchk) {};") code.putln("#endif") @@ -2339,7 +2338,7 @@ typedef struct { void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*NewContext)(const char*, int, const char*); - int (*FinishContext)(void**); + void (*FinishContext)(void**); } __Pyx_RefnannyAPIStruct; static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; #define __Pyx_ImportRefcountAPI(name) \ diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index b2f8691c..cb70b744 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1195,10 +1195,7 @@ class FuncDefNode(StatNode, BlockNode): if self.return_type.is_pyobject: code.put_xgiveref(self.return_type.as_pyobject(Naming.retval_cname)) - code.put_finish_refcount_context(self.pos, - self.entry.qualified_name, - Naming.retval_cname, - err_val) + code.put_finish_refcount_context() if acquire_gil: code.putln("PyGILState_Release(_save);") diff --git a/Cython/Runtime/refnanny.pyx b/Cython/Runtime/refnanny.pyx index d6e3403d..b3b3991c 100644 --- a/Cython/Runtime/refnanny.pyx +++ b/Cython/Runtime/refnanny.pyx @@ -115,7 +115,7 @@ cdef void DECREF(PyObject* ctx, PyObject* obj, int lineno): GIVEREF(ctx, obj, lineno) if obj is not NULL: Py_DECREF(obj) -cdef int FinishContext(PyObject** ctx) except -1: +cdef void FinishContext(PyObject** ctx): cdef PyObject* type = NULL, *value = NULL, *tb = NULL if ctx == NULL: assert False if ctx[0] == NULL: assert False # XXX What to do here? @@ -129,17 +129,12 @@ cdef int FinishContext(PyObject** ctx) except -1: Py_XDECREF(type) Py_XDECREF(value) Py_XDECREF(tb) - raise finally: Py_XDECREF(ctx[0]) ctx[0] = NULL if errors: print u"%s: %s()" % pos print errors # raise Error(errors) - return 0 - - - cdef extern from "Python.h": object PyCObject_FromVoidPtr(void*, void (*)(void*)) @@ -150,7 +145,7 @@ ctypedef struct RefnannyAPIStruct: void (*GOTREF)(PyObject*, PyObject*, int) void (*GIVEREF)(PyObject*, PyObject*, int) PyObject* (*NewContext)(char*, int, char*) except NULL - int (*FinishContext)(PyObject**) except -1 + void (*FinishContext)(PyObject**) cdef RefnannyAPIStruct api api.INCREF = INCREF