[Python-checkins] r43121 - python/trunk/Python/ast.c

nick.coghlan python-checkins at python.org
Fri Mar 17 18:59:16 CET 2006


Author: nick.coghlan
Date: Fri Mar 17 18:59:10 2006
New Revision: 43121

Modified:
   python/trunk/Python/ast.c
Log:
Fix bug 1441408 where a double colon didn't trigger extended slice semantics (applies patch 1452332)

Modified: python/trunk/Python/ast.c
==============================================================================
--- python/trunk/Python/ast.c	(original)
+++ python/trunk/Python/ast.c	Fri Mar 17 18:59:10 2006
@@ -1317,16 +1317,20 @@
 
     ch = CHILD(n, NCH(n) - 1);
     if (TYPE(ch) == sliceop) {
-	if (NCH(ch) == 1)
-            /* XXX: If only 1 child, then should just be a colon.  Should we
-               just skip assigning and just get to the return? */
-	    ch = CHILD(ch, 0);
-	else
-	    ch = CHILD(ch, 1);
-	if (TYPE(ch) == test) {
-	    step = ast_for_expr(c, ch);
+        if (NCH(ch) == 1) {
+            /* No expression, so step is None */
+            ch = CHILD(ch, 0);
+            step = Name(new_identifier("None", c->c_arena), Load,
+                        LINENO(ch), ch->n_col_offset, c->c_arena);
             if (!step)
                 return NULL;
+        } else {
+            ch = CHILD(ch, 1);
+            if (TYPE(ch) == test) {
+                step = ast_for_expr(c, ch);
+                if (!step)
+                    return NULL;
+            }
         }
     }
 


More information about the Python-checkins mailing list