From: Robert Bradshaw Date: Wed, 6 Jan 2010 18:45:13 +0000 (-0800) Subject: Merge 0.12 release. X-Git-Tag: 0.13.beta0~2^2~115 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b820fbba6db2e1bd94665375a9b0120cd1d121b4;p=cython.git Merge 0.12 release. --- b820fbba6db2e1bd94665375a9b0120cd1d121b4 diff --cc Cython/Compiler/Nodes.py index ce81e0ec,1f9f3aba..644ab12d --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@@ -1104,32 -1087,12 +1104,32 @@@ class FuncDefNode(StatNode, BlockNode) env.use_utility_code(force_init_threads_utility_code) code.putln("PyGILState_STATE _save = PyGILState_Ensure();") # ----- Automatic lead-ins for certain special functions - if profile: - code.put_trace_call(self.entry.name, self.pos) if not lenv.nogil: code.put_setup_refcount_context(self.entry.name) + if profile: + code.put_trace_call(self.entry.name, self.pos) if is_getbuffer_slot: self.getbuffer_init(code) + # ----- Create closure scope object + if self.needs_closure: + code.putln("%s = (%s)%s->tp_new(%s, %s, NULL);" % ( + Naming.cur_scope_cname, + lenv.scope_class.type.declaration_code(''), + lenv.scope_class.type.typeptr_cname, + lenv.scope_class.type.typeptr_cname, + Naming.empty_tuple)) + # TODO: error handling + code.put_gotref(Naming.cur_scope_cname) + # Note that it is unsafe to decref the scope at this point. + if env.is_closure_scope: + code.putln("%s = (%s)%s;" % ( + outer_scope_cname, + env.scope_class.type.declaration_code(''), + Naming.self_cname)) + if self.needs_closure: + # inner closures own a reference to their outer parent + code.put_incref(outer_scope_cname, env.scope_class.type) + code.put_giveref(outer_scope_cname) # ----- Fetch arguments self.generate_argument_parsing_code(env, code) # If an argument is assigned to in the body, we must @@@ -1750,12 -1704,10 +1752,13 @@@ class DefNode(FuncDefNode) if arg.not_none and not arg.type.is_extension_type: error(self.pos, "Only extension type arguments can have 'not None'") - self.declare_pyfunction(env) + if self.name == '': + self.declare_lambda_function(env) + else: + self.declare_pyfunction(env) self.analyse_signature(env) self.return_type = self.entry.signature.return_type() + self.create_local_scope(env) def analyse_signature(self, env): any_type_tests_needed = 0