Author: Brian Kearns <[email protected]>
Branch:
Changeset: r68528:a3b136aca239
Date: 2013-12-21 03:17 -0500
http://bitbucket.org/pypy/pypy/changeset/a3b136aca239/
Log: provide stub byteswap for record types to avoid segfault
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
@@ -3106,6 +3106,17 @@
a = array([(1, 2), (3, 4)], dtype=[('x', int), ('y', float)])
assert repr(a[0]) == '(1, 2.0)'
+ def test_void_copyswap(self):
+ import numpy as np
+ dt = np.dtype([('one', '<i4'), ('two', '<i4')])
+ x = np.array((1, 2), dtype=dt)
+ x = x.byteswap()
+ import sys
+ if '__pypy__' not in sys.builtin_module_names:
+ assert x['one'] > 0 and x['two'] > 2
+ else:
+ assert x['one'] == 1 and x['two'] == 2
+
def test_nested_dtype(self):
import numpy as np
a = [('x', int), ('y', float)]
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
@@ -1852,6 +1852,10 @@
for k in range(box.dtype.get_size()):
arr.storage[k + i + ofs] = box.arr.storage[k + box.ofs]
+ def byteswap(self, w_v):
+ # XXX implement
+ return w_v
+
def to_builtin_type(self, space, box):
assert isinstance(box, interp_boxes.W_VoidBox)
items = []
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit