Author: Benjamin Peterson <[email protected]>
Branch: py3k
Changeset: r53323:76eed8e498a1
Date: 2012-03-12 10:00 -0700
http://bitbucket.org/pypy/pypy/changeset/76eed8e498a1/

Log:    kill extended slicing crud in the compiler

diff --git a/pypy/interpreter/astcompiler/astbuilder.py 
b/pypy/interpreter/astcompiler/astbuilder.py
--- a/pypy/interpreter/astcompiler/astbuilder.py
+++ b/pypy/interpreter/astcompiler/astbuilder.py
@@ -906,10 +906,7 @@
                 upper = self.handle_expr(third_child)
         last_child = slice_node.children[-1]
         if last_child.type == syms.sliceop:
-            if len(last_child.children) == 1:
-                step = ast.Name("None", ast.Load, last_child.lineno,
-                                last_child.column)
-            else:
+            if len(last_child.children) != 1:
                 step_child = last_child.children[1]
                 if step_child.type == syms.test:
                     step = self.handle_expr(step_child)
diff --git a/pypy/interpreter/astcompiler/test/test_astbuilder.py 
b/pypy/interpreter/astcompiler/test/test_astbuilder.py
--- a/pypy/interpreter/astcompiler/test/test_astbuilder.py
+++ b/pypy/interpreter/astcompiler/test/test_astbuilder.py
@@ -983,9 +983,7 @@
         slc = self.get_first_expr("x[::]").slice
         assert slc.upper is None
         assert slc.lower is None
-        assert isinstance(slc.step, ast.Name)
-        assert slc.step.id == "None"
-        assert slc.step.ctx == ast.Load
+        assert slc.step is None
         slc = self.get_first_expr("x[1:]").slice
         assert isinstance(slc.lower, ast.Num)
         assert slc.upper is None
@@ -993,7 +991,7 @@
         slc = self.get_first_expr("x[1::]").slice
         assert isinstance(slc.lower, ast.Num)
         assert slc.upper is None
-        assert isinstance(slc.step, ast.Name)
+        assert slc.step is None
         slc = self.get_first_expr("x[:2]").slice
         assert slc.lower is None
         assert isinstance(slc.upper, ast.Num)
@@ -1001,7 +999,7 @@
         slc = self.get_first_expr("x[:2:]").slice
         assert slc.lower is None
         assert isinstance(slc.upper, ast.Num)
-        assert isinstance(slc.step, ast.Name)
+        assert slc.step is None
         slc = self.get_first_expr("x[2:2]").slice
         assert isinstance(slc.lower, ast.Num)
         assert isinstance(slc.upper, ast.Num)
@@ -1009,7 +1007,7 @@
         slc = self.get_first_expr("x[2:2:]").slice
         assert isinstance(slc.lower, ast.Num)
         assert isinstance(slc.upper, ast.Num)
-        assert isinstance(slc.step, ast.Name)
+        assert slc.step is None
         slc = self.get_first_expr("x[::2]").slice
         assert slc.lower is None
         assert slc.upper is None
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to