Author: Philip Jenvey <pjen...@underboss.org> Branch: Changeset: r68926:92a94109c1f3 Date: 2014-01-24 16:18 -0800 http://bitbucket.org/pypy/pypy/changeset/92a94109c1f3/
Log: merge upstream diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py --- a/pypy/module/micronumpy/interp_boxes.py +++ b/pypy/module/micronumpy/interp_boxes.py @@ -394,6 +394,9 @@ class W_Float64Box(W_FloatingBox, PrimitiveBox): descr__new__, _get_dtype, descr_reduce = new_dtype_getter("float64") + def descr_as_integer_ratio(self, space): + return space.call_method(self.item(space), 'as_integer_ratio') + class W_ComplexFloatingBox(W_InexactBox): def descr_get_real(self, space): dtype = self._COMPONENTS_BOX._get_dtype(space) @@ -719,6 +722,7 @@ __module__ = "numpy", __new__ = interp2app(W_Float64Box.descr__new__.im_func), __reduce__ = interp2app(W_Float64Box.descr_reduce), + as_integer_ratio = interp2app(W_Float64Box.descr_as_integer_ratio), ) W_ComplexFloatingBox.typedef = TypeDef("complexfloating", W_InexactBox.typedef, diff --git a/pypy/module/micronumpy/test/test_scalar.py b/pypy/module/micronumpy/test/test_scalar.py --- a/pypy/module/micronumpy/test/test_scalar.py +++ b/pypy/module/micronumpy/test/test_scalar.py @@ -181,6 +181,11 @@ s = np.dtype([('a', 'int64'), ('b', 'int64')]).type('a' * 16) assert s.view('S16') == 'a' * 16 + def test_as_integer_ratio(self): + import numpy as np + raises(AttributeError, 'np.float32(1.5).as_integer_ratio()') + assert np.float64(1.5).as_integer_ratio() == (3, 2) + def test_complex_scalar_complex_cast(self): import numpy as np for tp in [np.csingle, np.cdouble, np.clongdouble]: diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -594,9 +594,11 @@ if tobox is not None: # sanity check: see whether the current struct value # corresponds to what the cache thinks the value is - resbox = executor.execute(self.metainterp.cpu, self.metainterp, - rop.GETFIELD_GC, fielddescr, box) - assert resbox.constbox().same_constant(tobox.constbox()) + # XXX pypy with the following check fails on micronumpy, + # XXX investigate + #resbox = executor.execute(self.metainterp.cpu, self.metainterp, + # rop.GETFIELD_GC, fielddescr, box) + #assert resbox.constbox().same_constant(tobox.constbox()) return tobox resbox = self.execute_with_descr(opnum, fielddescr, box) self.metainterp.heapcache.getfield_now_known(box, fielddescr, resbox) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit