compile fixes in Parsing.py: kwargs names must be bytes before Py2.6
authorStefan Behnel <scoder@users.berlios.de>
Thu, 9 Dec 2010 10:00:03 +0000 (11:00 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 9 Dec 2010 10:00:03 +0000 (11:00 +0100)
Cython/Compiler/Parsing.pxd
Cython/Compiler/Parsing.py

index d9ed00eef2b583c3468d733bb58c605593a08d08..3c64665261e6402ea5e5fe5cbb0c2cbd2288d042 100644 (file)
@@ -104,7 +104,7 @@ cdef p_if_clause(PyrexScanner s)
 cdef p_else_clause(PyrexScanner s)
 cdef p_while_statement(PyrexScanner s)
 cdef p_for_statement(PyrexScanner s)
-cpdef p_for_bounds(PyrexScanner s, bint allow_testlist = *)
+cpdef dict p_for_bounds(PyrexScanner s, bint allow_testlist = *)
 cdef p_for_from_relation(PyrexScanner s)
 cdef p_for_from_step(PyrexScanner s)
 cdef p_target(PyrexScanner s, terminator)
index 904d2fdafaf3fd37adddf96047fb90ac269ec921..54b8665b5bd7865fb278e4ad764ee01583492b1f 100644 (file)
@@ -877,8 +877,7 @@ def p_comp_for(s, body):
     pos = s.position()
     s.next()
     kw = p_for_bounds(s, allow_testlist=False)
-    kw['else_clause'] = None
-    kw['body'] = p_comp_iter(s, body)
+    kw.update(else_clause = None, body = p_comp_iter(s, body))
     return Nodes.ForStatNode(pos, **kw)
         
 def p_comp_if(s, body):
@@ -1372,8 +1371,9 @@ def p_for_statement(s):
     pos = s.position()
     s.next()
     kw = p_for_bounds(s, allow_testlist=True)
-    kw['body'] = p_suite(s)
-    kw['else_clause'] = p_else_clause(s)
+    body = p_suite(s)
+    else_clause = p_else_clause(s)
+    kw.update(body = body, else_clause = else_clause)
     return Nodes.ForStatNode(pos, **kw)
             
 def p_for_bounds(s, allow_testlist=True):
@@ -1381,7 +1381,7 @@ def p_for_bounds(s, allow_testlist=True):
     if s.sy == 'in':
         s.next()
         iterator = p_for_iterator(s, allow_testlist)
-        return { 'target': target, 'iterator': iterator }
+        return dict( target = target, iterator = iterator )
     elif not s.in_python_file:
         if s.sy == 'from':
             s.next()
@@ -1408,12 +1408,13 @@ def p_for_bounds(s, allow_testlist=True):
         if rel1[0] != rel2[0]:
             error(rel2_pos,
                 "Relation directions in for-from do not match")
-        return {'target': target, 
-                'bound1': bound1, 
-                'relation1': rel1, 
-                'relation2': rel2,
-                'bound2': bound2,
-                'step': step }
+        return dict(target = target, 
+                    bound1 = bound1, 
+                    relation1 = rel1, 
+                    relation2 = rel2,
+                    bound2 = bound2,
+                    step = step,
+                    )
     else:
         s.expect('in')
         return {}