Author: Timo Paulssen <[email protected]>
Branch: numpy-data-buffer
Changeset: r47792:103438c04860
Date: 2011-10-03 15:49 +0200
http://bitbucket.org/pypy/pypy/changeset/103438c04860/
Log: fix error messages for index out of bounds.
diff --git a/pypy/module/_numpy/interp_buffer.py
b/pypy/module/_numpy/interp_buffer.py
--- a/pypy/module/_numpy/interp_buffer.py
+++ b/pypy/module/_numpy/interp_buffer.py
@@ -12,7 +12,7 @@
def getitem(self, index):
if index > self.getlength():
- raise IndexError("Index out of bounds (0<=index<%d)" %
self.getlength())
+ raise IndexError("Index out of bounds (0<=index<=%d)" %
self.getlength())
storage = self.array.get_concrete().get_root_storage()
char_data = rffi.cast(CHAR_TP, storage)
index = self.calc_index(index)
@@ -20,7 +20,7 @@
def setitem(self, index, value):
if index > self.getlength():
- raise IndexError("Index out of bounds (0<=index<%d)" %
self.getlength())
+ raise IndexError("Index out of bounds (0<=index<=%d)" %
self.getlength())
storage = self.array.get_concrete().get_root_storage()
char_ptr = rffi.cast(CHAR_TP, storage)
index = self.calc_index(index)
@@ -28,7 +28,7 @@
def setslice(self, index, newstring):
if index + len(newstring) > self.getlength():
- raise IndexError("End of slice to set out of bounds (0<=index<%d)"
% self.getlength())
+ raise IndexError("End of slice to set out of bounds
(0<=index<=%d)" % self.getlength())
for idx in range(0, len(newstring)):
self.setitem(index + idx, newstring[idx])
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit