From: Robert Bradshaw Date: Thu, 1 Nov 2007 01:58:28 +0000 (-0700) Subject: Fix function import refcount (Stefan Behnel) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ac6d9069f984b43e8f24cc86a5cd70527eeb3423;p=cython.git Fix function import refcount (Stefan Behnel) --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 84f5af04..8526687b 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -166,9 +166,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): entry.name, entry.cname, sig)) - h_code.putln("Py_DECREF(module);") + h_code.putln("Py_DECREF(module); module = 0;") for entry in public_extension_types: - self.generate_type_import_call(entry.type, h_code, "goto bad;") + self.generate_type_import_call( + entry.type, h_code, + "if (!%s) goto bad;" % entry.type.typeptr_cname) h_code.putln("return 0;") h_code.putln("bad:") h_code.putln("Py_XDECREF(module);")