fix constant_result of SliceNode
authorStefan Behnel <scoder@users.berlios.de>
Mon, 31 Jan 2011 11:41:58 +0000 (12:41 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 31 Jan 2011 11:41:58 +0000 (12:41 +0100)
Cython/Compiler/ExprNodes.py

index 555588cf738e4e9ef5e2cbd0ee80cd026ed64273..fc059eb9bc93830cddd4d6260f773c37def7fa64 100755 (executable)
@@ -2691,14 +2691,16 @@ class SliceNode(ExprNode):
     #  stop      ExprNode
     #  step      ExprNode
 
+    subexprs = ['start', 'stop', 'step']
+
     type = py_object_type
     is_temp = 1
 
     def calculate_constant_result(self):
-        self.constant_result = self.base.constant_result[
-            self.start.constant_result : \
-                self.stop.constant_result : \
-                self.step.constant_result]
+        self.constant_result = slice(
+            self.start.constant_result,
+            self.stop.constant_result,
+            self.step.constant_result)
 
     def compile_time_value(self, denv):
         start = self.start.compile_time_value(denv)
@@ -2715,8 +2717,6 @@ class SliceNode(ExprNode):
         except Exception, e:
             self.compile_time_value_error(e)
 
-    subexprs = ['start', 'stop', 'step']
-
     def analyse_types(self, env):
         self.start.analyse_types(env)
         self.stop.analyse_types(env)