[pypy-commit] pypy default: (arigo, fijal) kill a completely obscure case by using slower method. document
fijal
noreply at buildbot.pypy.org
Tue Jul 3 18:34:20 CEST 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r55901:22c791a26114
Date: 2012-07-03 18:32 +0200
http://bitbucket.org/pypy/pypy/changeset/22c791a26114/
Log: (arigo, fijal) kill a completely obscure case by using slower
method. document it as a hack
diff --git a/pypy/module/array/interp_array.py b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -377,26 +377,18 @@
def setitem__Array_Slice_Array(space, self, w_idx, w_item):
start, stop, step, size = self.space.decode_index4(w_idx, self.len)
assert step != 0
- if w_item.len != size:
+ if w_item.len != size or self is w_item:
+ # XXX this is a giant slow hack
w_lst = array_tolist__Array(space, self)
w_item = space.call_method(w_item, 'tolist')
space.setitem(w_lst, w_idx, w_item)
self.setlen(0)
self.fromsequence(w_lst)
else:
- if self is w_item:
- with lltype.scoped_alloc(mytype.arraytype, self.allocated) as new_buffer:
- for i in range(self.len):
- new_buffer[i] = w_item.buffer[i]
- j = 0
- for i in range(start, stop, step):
- self.buffer[i] = new_buffer[j]
- j += 1
- else:
- j = 0
- for i in range(start, stop, step):
- self.buffer[i] = w_item.buffer[j]
- j += 1
+ j = 0
+ for i in range(start, stop, step):
+ self.buffer[i] = w_item.buffer[j]
+ j += 1
def setslice__Array_ANY_ANY_ANY(space, self, w_i, w_j, w_x):
space.setitem(self, space.newslice(w_i, w_j, space.w_None), w_x)
@@ -468,6 +460,7 @@
self.buffer[i] = val
def delitem__Array_ANY(space, self, w_idx):
+ # XXX this is a giant slow hack
w_lst = array_tolist__Array(space, self)
space.delitem(w_lst, w_idx)
self.setlen(0)
@@ -615,6 +608,7 @@
# Compare methods
@specialize.arg(3)
def _cmp_impl(space, self, other, space_fn):
+ # XXX this is a giant slow hack
w_lst1 = array_tolist__Array(space, self)
w_lst2 = space.call_method(other, 'tolist')
return space_fn(w_lst1, w_lst2)
More information about the pypy-commit
mailing list