Commit 94981010 authored by Stefan Behnel's avatar Stefan Behnel

revert last two commits - does not work for negative indices

parent 90c32eb4
...@@ -3649,16 +3649,9 @@ class SliceIndexNode(ExprNode): ...@@ -3649,16 +3649,9 @@ class SliceIndexNode(ExprNode):
stop_code, stop_code,
code.error_goto_if_null(result, self.pos))) code.error_goto_if_null(result, self.pos)))
else: else:
if self.base.type is list_type:
cfunc = 'PyList_GetSlice'
elif self.base.type is tuple_type:
cfunc = 'PyTuple_GetSlice'
else:
cfunc = '__Pyx_PySequence_GetSlice'
code.putln( code.putln(
"%s = %s(%s, %s, %s); %s" % ( "%s = __Pyx_PySequence_GetSlice(%s, %s, %s); %s" % (
result, result,
cfunc,
self.base.py_result(), self.base.py_result(),
start_code, start_code,
stop_code, stop_code,
...@@ -3668,13 +3661,8 @@ class SliceIndexNode(ExprNode): ...@@ -3668,13 +3661,8 @@ class SliceIndexNode(ExprNode):
def generate_assignment_code(self, rhs, code): def generate_assignment_code(self, rhs, code):
self.generate_subexpr_evaluation_code(code) self.generate_subexpr_evaluation_code(code)
if self.type.is_pyobject: if self.type.is_pyobject:
if self.base.type is list_type:
cfunc = 'PyList_SetSlice'
else:
cfunc = '__Pyx_PySequence_SetSlice'
code.put_error_if_neg(self.pos, code.put_error_if_neg(self.pos,
"%s(%s, %s, %s, %s)" % ( "__Pyx_PySequence_SetSlice(%s, %s, %s, %s)" % (
cfunc,
self.base.py_result(), self.base.py_result(),
self.start_code(), self.start_code(),
self.stop_code(), self.stop_code(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment