From: Stefan Behnel Date: Tue, 6 Oct 2009 08:03:44 +0000 (+0200) Subject: merged in latest cython-unstable X-Git-Tag: 0.13.beta0~2^2~123 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=92135ccfe90af955fe3c1e36bbd13721fed9fd17;p=cython.git merged in latest cython-unstable --- 92135ccfe90af955fe3c1e36bbd13721fed9fd17 diff --cc Cython/Compiler/Main.py index 4e687d9f,7f43c94f..28997971 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@@ -112,15 -120,14 +120,16 @@@ class Context(object) NormalizeTree(self), PostParse(self), _specific_post_parse, - InterpretCompilerDirectives(self, self.pragma_overrides), + InterpretCompilerDirectives(self, self.compiler_directives), _align_function_definitions, + MarkClosureVisitor(self), ConstantFolding(), FlattenInListTransform(), WithTransform(self), DecoratorTransform(self), AnalyseDeclarationsTransform(self), + CreateClosureClasses(self), + AutoTestDictTransform(self), EmbedSignature(self), TransformBuiltinMethods(self), IntroduceBufferAuxiliaryVars(self), diff --cc Cython/Compiler/ModuleNode.py index 4bbfe999,dd3161b7..70341f69 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@@ -253,13 -268,9 +268,13 @@@ class ModuleNode(Nodes.Node, Nodes.Bloc code.putln("") code.putln("/* Implementation of %s */" % env.qualified_name) - code.globalstate.insert_global_var_declarations_into(code) + code = globalstate['all_the_rest'] self.generate_cached_builtins_decls(env, code) + # generate lambda function definitions + for node in env.lambda_defs: + node.generate_function_definitions(env, code) + # generate normal function definitions self.body.generate_function_definitions(env, code) code.mark_pos(None) self.generate_typeobj_definitions(env, code) diff --cc Cython/Compiler/Naming.py index c1d73123,059779d6..7c4e465f --- a/Cython/Compiler/Naming.py +++ b/Cython/Compiler/Naming.py @@@ -44,9 -44,7 +44,10 @@@ vtabptr_prefix = pyrex_prefix + "vta vtabstruct_prefix = pyrex_prefix + "vtabstruct_" opt_arg_prefix = pyrex_prefix + "opt_args_" convert_func_prefix = pyrex_prefix + "convert_" +closure_scope_prefix = pyrex_prefix + "scope_" +closure_class_prefix = pyrex_prefix + "scope_struct_" +lambda_func_prefix = pyrex_prefix + "lambda_" + module_is_main = pyrex_prefix + "module_is_main_" args_cname = pyrex_prefix + "args" pykwdlist_cname = pyrex_prefix + "pyargnames" @@@ -84,8 -83,10 +86,11 @@@ pymoduledef_cname = pyrex_prefix + "mod optional_args_cname = pyrex_prefix + "optional_args" import_star = pyrex_prefix + "import_star" import_star_set = pyrex_prefix + "import_star_set" - cur_scope_cname = pyrex_prefix + "scope" +outer_scope_cname= pyrex_prefix + "outer_scope" + cur_scope_cname = pyrex_prefix + "cur_scope" + enc_scope_cname = pyrex_prefix + "enc_scope" + frame_cname = pyrex_prefix + "frame" + frame_code_cname = pyrex_prefix + "frame_code" line_c_macro = "__LINE__" diff --cc Cython/Compiler/Nodes.py index 183a6faf,4873ace4..71bf63cc --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@@ -11,9 -11,10 +11,10 @@@ import Namin import PyrexTypes import TypeSlots from PyrexTypes import py_object_type, error_type, CTypedefType, CFuncType -from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, \ +from Symtab import ModuleScope, LocalScope, ClosureScope, \ StructOrUnionScope, PyClassScope, CClassScope - from Cython.Utils import open_new_file, replace_suffix, UtilityCode + from Cython.Utils import open_new_file, replace_suffix + from Code import UtilityCode from StringEncoding import EncodedString, escape_byte_string, split_docstring import Options import ControlFlow diff --cc Cython/Compiler/Parsing.pxd index 7af84501,047b2e7f..bca87ddf --- a/Cython/Compiler/Parsing.pxd +++ b/Cython/Compiler/Parsing.pxd @@@ -142,10 -139,9 +142,10 @@@ cpdef p_c_modifiers(PyrexScanner s cpdef p_c_func_or_var_declaration(PyrexScanner s, pos, ctx) cpdef p_ctypedef_statement(PyrexScanner s, ctx) cpdef p_decorators(PyrexScanner s) -cpdef p_def_statement(PyrexScanner s, decorators = *) +cpdef p_def_statement(PyrexScanner s, list decorators = *) +cpdef p_varargslist(PyrexScanner s, terminator=*) cpdef p_py_arg_decl(PyrexScanner s) - cpdef p_class_statement(PyrexScanner s) + cpdef p_class_statement(PyrexScanner s, decorators) cpdef p_c_class_definition(PyrexScanner s, pos, ctx) cpdef p_c_class_options(PyrexScanner s) cpdef p_property_decl(PyrexScanner s) diff --cc Cython/Compiler/Symtab.py index a6b5165f,39115b71..4fc5031b --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@@ -247,8 -242,8 +248,9 @@@ class Scope(object) self.obj_to_entry = {} self.pystring_entries = [] self.buffer_entries = [] + self.lambda_defs = [] self.control_flow = ControlFlow.LinearControlFlow() + self.return_type = None def start_branching(self, pos): self.control_flow = self.control_flow.start_branch(pos)