From: Stefan Behnel Date: Thu, 27 Jan 2011 20:07:52 +0000 (+0100) Subject: fix tweak: closure variables are not safe as function arguments; the last argument... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1c157dc182fc3c6242c7680b29b47dbee8c0996b;p=cython.git fix tweak: closure variables are not safe as function arguments; the last argument is safe, too --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 1953630a..fe5463bf 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -2977,12 +2977,12 @@ class SimpleCallNode(CallNode): # if some args are temps and others are not, they may get # constructed in the wrong order (temps first) => make # sure they are either all temps or all not temps - for i in range(min(max_nargs, actual_nargs)): + for i in range(min(max_nargs, actual_nargs)-1): arg = self.args[i] if arg.is_name and arg.entry and ( - arg.entry.is_local or arg.entry.in_closure or arg.entry.type.is_cfunction): - # local variables are safe - # TODO: what about the non-local keyword? + (arg.entry.is_local and not arg.entry.in_closure) + or arg.entry.type.is_cfunction): + # local variables and C functions are safe pass elif env.nogil and arg.type.is_pyobject: # can't copy a Python reference into a temp in nogil