fix for slice assignment
authorLisandro Dalcin <dalcinl@gmail.com>
Wed, 24 Feb 2010 20:21:15 +0000 (17:21 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Wed, 24 Feb 2010 20:21:15 +0000 (17:21 -0300)
Cython/Compiler/ExprNodes.py
tests/run/slice2b.pyx [new file with mode: 0644]

index 1f0a687c70247390d39f73e005e45b2c660fa492..209c1a807f7a0e13555cda89fce8fd4c7f4f907d 100755 (executable)
@@ -2279,7 +2279,7 @@ class SliceIndexNode(ExprNode):
                     self.base.py_result(),
                     self.start_code(),
                     self.stop_code(),
-                    rhs.result()))
+                    rhs.py_result()))
         else:
             start_offset = ''
             if self.start:
diff --git a/tests/run/slice2b.pyx b/tests/run/slice2b.pyx
new file mode 100644 (file)
index 0000000..3e56b3f
--- /dev/null
@@ -0,0 +1,14 @@
+cdef extern from *:
+    ctypedef class __builtin__.list [ object PyListObject ]:
+        pass
+
+def slice_of_typed_value():
+
+    """
+    >>> slice_of_typed_value()
+    [1, 2, 3]
+    """
+    cdef object a = []
+    cdef list L = [1, 2, 3]
+    a[:] = L
+    return a