From: Stefan Behnel Date: Wed, 21 Oct 2009 06:46:40 +0000 (+0200) Subject: merged in latest cython-devel (with minor merge fixes) X-Git-Tag: 0.13.beta0~2^2~121 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=39d60c718daf06898e85a37e92542708d6a70143;p=cython.git merged in latest cython-devel (with minor merge fixes) --- 39d60c718daf06898e85a37e92542708d6a70143 diff --cc Cython/Compiler/ExprNodes.py index 5a4e53d5,da8b6972..0a10e943 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@@ -1239,8 -1365,9 +1365,9 @@@ class NameNode(AtomicExprNode) code.put_xdecref(self.result(), self.ctype()) else: code.put_decref(self.result(), self.ctype()) - if entry.is_cglobal or entry.in_closure: - code.put_giveref(rhs.py_result()) + if self.use_managed_ref: - if entry.is_cglobal: ++ if entry.is_cglobal or entry.in_closure: + code.put_giveref(rhs.py_result()) code.putln('%s = %s;' % (self.result(), rhs.result_as(self.ctype()))) if debug_disposal_code: print("NameNode.generate_assignment_code:") @@@ -3732,30 -3930,20 +3956,32 @@@ class PyCFunctionNode(ExprNode) # from a PyMethodDef struct. # # pymethdef_cname string PyMethodDef structure + # self_object ExprNode or None + + subexprs = [] + self_object = None + type = py_object_type + is_temp = 1 + def analyse_types(self, env): - self.type = py_object_type - self.is_temp = 1 - + pass + gil_message = "Constructing Python function" + def self_result_code(self): + if self.self_object is None: + self_result = "NULL" + else: + self_result = self.self_object.py_result() + return self_result + def generate_result_code(self, code): code.putln( - "%s = PyCFunction_New(&%s, 0); %s" % ( + "%s = PyCFunction_New(&%s, %s); %s" % ( self.result(), self.pymethdef_cname, + self.self_result_code(), code.error_goto_if_null(self.result(), self.pos))) code.put_gotref(self.py_result()) diff --cc Cython/Compiler/Main.py index 28997971,162dad27..18d203d2 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@@ -128,9 -128,9 +129,10 @@@ class Context(object) WithTransform(self), DecoratorTransform(self), AnalyseDeclarationsTransform(self), + CreateClosureClasses(self), AutoTestDictTransform(self), EmbedSignature(self), + MarkAssignments(self), TransformBuiltinMethods(self), IntroduceBufferAuxiliaryVars(self), _check_c_declarations, diff --cc Cython/Compiler/Nodes.py index 0e16e029,97ea7461..9d832357 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@@ -10,8 -16,8 +16,8 @@@ from Errors import error, warning, Inte import Naming import PyrexTypes import TypeSlots -from PyrexTypes import py_object_type, error_type, CFuncType -from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, \ +from PyrexTypes import py_object_type, error_type, CTypedefType, CFuncType - from Symtab import ModuleScope, LocalScope, ClosureScope, \ ++from Symtab import ModuleScope, LocalScope, GeneratorLocalScope, ClosureScope, \ StructOrUnionScope, PyClassScope, CClassScope from Cython.Utils import open_new_file, replace_suffix from Code import UtilityCode diff --cc Cython/Compiler/Symtab.py index 4fc5031b,bb96dd45..9e30e6c1 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@@ -1056,8 -1059,12 +1072,12 @@@ class ModuleScope(Scope) var_entry.is_cglobal = 1 var_entry.is_readonly = 1 entry.as_variable = var_entry + + def infer_types(self): + from TypeInference import PyObjectTypeInferer + PyObjectTypeInferer().infer_types(self) -class LocalScope(Scope): +class LocalScope(Scope): def __init__(self, name, outer_scope): Scope.__init__(self, name, outer_scope, outer_scope)