From 503a314b6301e4362bcd573700d1cde6cefb4bc9 Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Tue, 3 Feb 2009 15:39:04 -0200 Subject: [PATCH] GIL state needs to be released after finishing refnanny contexts --- Cython/Compiler/Nodes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 7664e0de..0002cb21 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1181,8 +1181,7 @@ class FuncDefNode(StatNode, BlockNode): for entry in lenv.arg_entries: if entry.type.is_pyobject and lenv.control_flow.get_state((entry.name, 'source')) != 'arg': code.put_var_decref(entry) - if acquire_gil: - code.putln("PyGILState_Release(_save);") + # code.putln("/* TODO: decref scope object */") # ----- Return # This code is duplicated in ModuleNode.generate_module_init_func @@ -1199,6 +1198,9 @@ class FuncDefNode(StatNode, BlockNode): Naming.retval_cname, err_val) + if acquire_gil: + code.putln("PyGILState_Release(_save);") + if not self.return_type.is_void: code.putln("return %s;" % Naming.retval_cname) -- 2.26.2