[pypy-svn] r52973 - in pypy/dist/pypy/lib: _ctypes app_test/ctypes
fijal at codespeak.net
fijal at codespeak.net
Thu Mar 27 02:34:40 CET 2008
Author: fijal
Date: Thu Mar 27 02:34:38 2008
New Revision: 52973
Modified:
pypy/dist/pypy/lib/_ctypes/array.py
pypy/dist/pypy/lib/app_test/ctypes/test_slicing.py
Log:
raise value error when assigning slice of different length.
Modified: pypy/dist/pypy/lib/_ctypes/array.py
==============================================================================
--- pypy/dist/pypy/lib/_ctypes/array.py (original)
+++ pypy/dist/pypy/lib/_ctypes/array.py Thu Mar 27 02:34:38 2008
@@ -115,6 +115,8 @@
def array_slice_setitem(self, index, value):
start, stop = self._get_slice_params(index)
+ if stop - start != len(value):
+ raise ValueError("Can only assign slices of the same length")
for i in range(start, stop):
self[i] = value[i - start]
Modified: pypy/dist/pypy/lib/app_test/ctypes/test_slicing.py
==============================================================================
--- pypy/dist/pypy/lib/app_test/ctypes/test_slicing.py (original)
+++ pypy/dist/pypy/lib/app_test/ctypes/test_slicing.py Thu Mar 27 02:34:38 2008
@@ -21,7 +21,6 @@
assert a[0:5] == range(5, 10)
def test_setslice_cint(self):
- py.test.skip("XXX bugs")
a = (c_int * 100)(*xrange(1100, 1200))
b = range(1100, 1200)
More information about the Pypy-commit
mailing list