From ac6d9069f984b43e8f24cc86a5cd70527eeb3423 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 31 Oct 2007 18:58:28 -0700 Subject: [PATCH] Fix function import refcount (Stefan Behnel) --- Cython/Compiler/ModuleNode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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);") -- 2.26.2