From: Stefan Behnel Date: Thu, 28 Jan 2010 22:27:58 +0000 (+0100) Subject: merged in latest cython-devel X-Git-Tag: 0.13.beta0~2^2~111 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0ca511426b08d5a402a91a3df27f372f9062824e;p=cython.git merged in latest cython-devel --- 0ca511426b08d5a402a91a3df27f372f9062824e diff --cc Cython/Compiler/Main.py index fcac64e1,04f4bc2c..c36f3442 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@@ -130,9 -130,9 +131,10 @@@ class Context(object) WithTransform(self), DecoratorTransform(self), AnalyseDeclarationsTransform(self), + CreateClosureClasses(self), AutoTestDictTransform(self), EmbedSignature(self), + EarlyReplaceBuiltinCalls(self), MarkAssignments(self), TransformBuiltinMethods(self), IntroduceBufferAuxiliaryVars(self), diff --cc Cython/Compiler/Nodes.py index e77ebf90,5cd40d76..a87d1af0 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@@ -597,8 -597,8 +597,9 @@@ class CArgDeclNode(Node) # not_none boolean Tagged with 'not None' # default ExprNode or None # default_value PyObjectConst constant for default value + # annotation ExprNode or None Py3 function arg annotation # is_self_arg boolean Is the "self" arg of an extension type method + # is_type_arg boolean Is the "class" arg of an extension type classmethod # is_kw_only boolean Is a keyword-only argument child_attrs = ["base_type", "declarator", "default"] @@@ -1646,10 -1605,9 +1657,10 @@@ class DefNode(FuncDefNode) reqd_kw_flags_cname = "0" is_wrapper = 0 decorators = None + return_type_annotation = None entry = None acquire_gil = 0 - + self_in_stararg = 0 def __init__(self, pos, **kwds): FuncDefNode.__init__(self, pos, **kwds) @@@ -1725,6 -1683,28 +1736,31 @@@ directive_locals = getattr(cfunc, 'directive_locals', {})) def analyse_declarations(self, env): + self.is_classmethod = self.is_staticmethod = False + if self.decorators: + for decorator in self.decorators: + func = decorator.decorator + if func.is_name: + self.is_classmethod |= func.name == 'classmethod' + self.is_staticmethod |= func.name == 'staticmethod' + + if self.is_classmethod and env.lookup_here('classmethod'): + # classmethod() was overridden - not much we can do here ... + self.is_classmethod = False + if self.is_staticmethod and env.lookup_here('staticmethod'): + # staticmethod() was overridden - not much we can do here ... + self.is_staticmethod = False + + self.analyse_argument_types(env) - 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_argument_types(self, env): directive_locals = self.directive_locals = env.directives['locals'] for arg in self.args: if hasattr(arg, 'name'):