[pypy-commit] pypy default: Fix PyPy issue 1589
rguillebert
noreply at buildbot.pypy.org
Fri Oct 4 21:28:48 CEST 2013
Author: Romain Guillebert <romain.py at gmail.com>
Branch:
Changeset: r67153:9e583c8e7b41
Date: 2013-10-04 21:24 +0200
http://bitbucket.org/pypy/pypy/changeset/9e583c8e7b41/
Log: Fix PyPy issue 1589
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -2965,6 +2965,12 @@
assert len(list(a[0])) == 2
+ def test_issue_1589(self):
+ import numpypy as numpy
+ c = numpy.array([[(1, 2, 'a'), (3, 4, 'b')], [(5, 6, 'c'), (7, 8, 'd')]],
+ dtype=[('bg', 'i8'), ('fg', 'i8'), ('char', 'S1')])
+ assert c[0][0]["char"] == 'a'
+
class AppTestPyPy(BaseNumpyAppTest):
def setup_class(cls):
if option.runappdirect and '__pypy__' not in sys.builtin_module_names:
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -1766,14 +1766,14 @@
def store(self, arr, i, offset, box):
assert isinstance(box, interp_boxes.W_StringBox)
- # XXX simplify to range(box.dtype.get_size()) ?
return self._store(arr.storage, i, offset, box)
@jit.unroll_safe
def _store(self, storage, i, offset, box):
assert isinstance(box, interp_boxes.W_StringBox)
- for k in range(min(self.size, box.arr.size-offset)):
- storage[k + i] = box.arr.storage[k + offset]
+ # XXX simplify to range(box.dtype.get_size()) ?
+ for k in range(min(self.size, box.arr.size-box.ofs)):
+ storage[k + offset + i] = box.arr.storage[k + box.ofs]
def read(self, arr, i, offset, dtype=None):
if dtype is None:
More information about the pypy-commit
mailing list