merged in latest cython-devel
authorStefan Behnel <scoder@users.berlios.de>
Sat, 20 Mar 2010 12:37:11 +0000 (13:37 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 20 Mar 2010 12:37:11 +0000 (13:37 +0100)
1  2 
Cython/Compiler/Code.py
Cython/Compiler/ExprNodes.py
Cython/Compiler/Main.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Nodes.py
Cython/Compiler/Options.py
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/Parsing.py
Cython/Compiler/Symtab.py
Cython/Compiler/TypeInference.py

Simple merge
Simple merge
Simple merge
index 85b0b1789089c4a1e798d9d627ecb9f89d884a29,722293760b4737b26085271dc531d0e871f96b3e..6b859990fe2688700536f7ec72871e38d908e16d
@@@ -1671,16 -1660,10 +1658,12 @@@ class ModuleNode(Nodes.Node, Nodes.Bloc
          code.putln("__pyx_refnanny = __Pyx_RefNanny->SetupContext(\"%s\", __LINE__, __FILE__);"% header3)
          code.putln("#endif")
  
 -        self.generate_filename_init_call(code)
 -
          code.putln("%s = PyTuple_New(0); %s" % (Naming.empty_tuple, code.error_goto_if_null(Naming.empty_tuple, self.pos)));
-         code.putln("#if PY_MAJOR_VERSION < 3");
-         code.putln("%s = PyString_FromStringAndSize(\"\", 0); %s" % (Naming.empty_bytes, code.error_goto_if_null(Naming.empty_bytes, self.pos)));
-         code.putln("#else");
-         code.putln("%s = PyBytes_FromStringAndSize(\"\", 0); %s" % (Naming.empty_bytes, code.error_goto_if_null(Naming.empty_bytes, self.pos)));
-         code.putln("#endif");
+         code.putln("%s = __Pyx_PyBytes_FromStringAndSize(\"\", 0); %s" % (Naming.empty_bytes, code.error_goto_if_null(Naming.empty_bytes, self.pos)));
 +        
 +        code.putln("#ifdef %s_USED" % Naming.binding_cfunc)
 +        code.putln("if (%s_init() < 0) %s" % (Naming.binding_cfunc, code.error_goto(self.pos)))
 +        code.putln("#endif")
  
          code.putln("/*--- Library function declarations ---*/")
          env.generate_library_function_declarations(code)
Simple merge
Simple merge
index c9583bbe83552414045b4317f4aed0306f4b2f11,3ee56367c639fd7c6283607346d34ce45fff03c4..63b85e5a16a5d3ad0cdaeeed7bf965fcf657a065
@@@ -1379,9 -1331,15 +1379,15 @@@ def p_except_clause(s)
      exc_value = None
      if s.sy != ':':
          exc_type = p_simple_expr(s)
 -        if s.sy == ',':
 +        if s.sy == ',' or (s.sy == 'IDENT' and s.systring == 'as'):
              s.next()
              exc_value = p_simple_expr(s)
+         elif s.sy == 'IDENT' and s.systring == 'as':
+             # Py3 syntax requires a name here
+             s.next()
+             pos2 = s.position()
+             name = p_ident(s)
+             exc_value = ExprNodes.NameNode(pos2, name = name)
      body = p_suite(s)
      return Nodes.ExceptClauseNode(pos,
          pattern = exc_type, target = exc_value, body = body)
@@@ -2135,10 -2089,17 +2141,18 @@@ def p_c_arg_decl(s, ctx, in_pyfunc, cme
      pos = s.position()
      not_none = 0
      default = None
-     base_type = p_c_base_type(s, cmethod_flag, nonempty = nonempty)
 +    annotation = None
+     if s.in_python_file:
+         # empty type declaration
+         base_type = Nodes.CSimpleBaseTypeNode(pos,
+             name = None, module_path = [],
+             is_basic_c_type = 0, signed = 0,
+             complex = 0, longness = 0,
+             is_self_arg = cmethod_flag, templates = None)
+     else:
+         base_type = p_c_base_type(s, cmethod_flag, nonempty = nonempty)
      declarator = p_c_declarator(s, ctx, nonempty = nonempty)
-     if s.sy == 'not':
+     if s.sy == 'not' and not s.in_python_file:
          s.next()
          if s.sy == 'IDENT' and s.systring == 'None':
              s.next()
Simple merge
Simple merge