Author: mattip <matti.pi...@gmail.com> Branch: Changeset: r74892:218d49b0e351 Date: 2014-12-11 23:30 +0200 http://bitbucket.org/pypy/pypy/changeset/218d49b0e351/
Log: fix test, coercing values to records - reduces numpy incompatability diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -2923,11 +2923,7 @@ a = empty(10, dtype=[(_, int) for _ in 'abcde']) a.fill(123) for i in a: - import sys - if '__pypy__' in sys.builtin_module_names: - assert tuple(i) == (123,) + (0,) * 4 - else: - assert tuple(i) == (123,) * 5 + assert tuple(i) == (123,) * 5 a = zeros(3, dtype=dtype(complex).newbyteorder()) a.fill(1.5+2.5j) @@ -3857,7 +3853,7 @@ a = np.array([b, b, b], dtype=dt) assert a.shape == (3, 2) for i in a.flat: - assert tuple(i) == (True, False) + assert tuple(i) == (True, True) dt = np.dtype([('A', '<i8'), ('B', '<f8'), ('C', '<c16')]) b = np.array((999999, 1e+20, 1e+20+0j), dtype=dt) 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 @@ -311,26 +311,26 @@ BoxType = boxes.W_BoolBox format_code = "?" - True = BoxType(True) - False = BoxType(False) + _True = BoxType(True) + _False = BoxType(False) @specialize.argtype(1) def box(self, value): box = Primitive.box(self, value) if box.value: - return self.True + return self._True else: - return self.False + return self._False @specialize.argtype(1, 2) def box_complex(self, real, imag): box = Primitive.box(self, real) if box.value: - return self.True + return self._True box = Primitive.box(self, imag) if box.value: - return self.True - return self.False + return self._True + return self._False def coerce_subtype(self, space, w_subtype, w_item): # Doesn't return subclasses so it can return the constants. @@ -1869,7 +1869,7 @@ items_w = space.fixedview(w_item.get_scalar_value()) else: # XXX support initializing from readable buffers - items_w = [w_item] + items_w = [w_item] * len(dtype.fields) else: items_w = [None] * len(dtype.fields) arr = VoidBoxStorage(dtype.elsize, dtype) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit