Author: Armin Rigo <[email protected]>
Branch: py3k
Changeset: r87325:6208459577ec
Date: 2016-09-22 15:51 +0200
http://bitbucket.org/pypy/pypy/changeset/6208459577ec/
Log: Test and fix
diff --git a/pypy/objspace/std/memoryobject.py
b/pypy/objspace/std/memoryobject.py
--- a/pypy/objspace/std/memoryobject.py
+++ b/pypy/objspace/std/memoryobject.py
@@ -198,17 +198,17 @@
def _start_from_tuple(self, space, w_tuple):
- from pypy.objspace.std.tupleobject import W_TupleObject
+ from pypy.objspace.std.tupleobject import W_AbstractTupleObject
start = 0
view = self.buf
length = space.len_w(w_tuple)
dim = view.getndim()
dim = 0
- assert isinstance(w_tuple, W_TupleObject)
+ assert isinstance(w_tuple, W_AbstractTupleObject)
while dim < length:
w_obj = w_tuple.getitem(space, dim)
- index = w_obj.int_w(space)
+ index = space.getindex_w(w_obj, space.w_IndexError)
start = self.lookup_dimension(space, start, dim, index)
dim += 1
return start
diff --git a/pypy/objspace/std/test/test_memoryobject.py
b/pypy/objspace/std/test/test_memoryobject.py
--- a/pypy/objspace/std/test/test_memoryobject.py
+++ b/pypy/objspace/std/test/test_memoryobject.py
@@ -323,7 +323,8 @@
assert view[-1,-1] == 11
assert view[-3,-4] == 0
- raises(IndexError, "view.__getitem__((2**63-1,0))")
+ raises(IndexError, "view.__getitem__((2**31-1, 0))")
+ raises(IndexError, "view.__getitem__((2**63+1, 0))")
raises(TypeError, "view.__getitem__((0, 0, 0))")
def test_tuple_indexing_int(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit