merged in latest cython-devel (with minor merge fixes)
authorStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 06:46:40 +0000 (08:46 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 06:46:40 +0000 (08:46 +0200)
1  2 
Cython/Compiler/ExprNodes.py
Cython/Compiler/Main.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py
Cython/Compiler/Optimize.py
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/Parsing.py
Cython/Compiler/Symtab.py

index 5a4e53d5f2a9da86991c5422a3e4cf8955bec8b9,da8b69728b4bdc5d1af9317353415f3f456bf13c..0a10e94309e9b49370d0a4db01563de658a33970
@@@ -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())
  
index 289979711945347591fe815db77b19b9f950cef0,162dad270cd2291e1a9afd7035074b7e08671ec7..18d203d252d29bffb02a25ed7c5171ec97b568ed
@@@ -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,
Simple merge
index 0e16e029ed0b9ef7a00b11ee75d1d4dd33fb436a,97ea74613cbc07be7bf0838df85952810ca2f7cd..9d8323570654d569ced04d90db70e481b542aa72
@@@ -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
Simple merge
Simple merge
index 4fc5031be0871d2be36dcc9a9968b5f2ff11666a,bb96dd45a844ff5e209d98aaecf4140202ae80fe..9e30e6c163312fd2846e8c170a95e76b6b0be4c1
@@@ -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)