[pypy-commit] pypy default: added ror to ndarray

alex_gaynor noreply at buildbot.pypy.org
Thu Feb 9 15:13:28 CET 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r52292:8f4b87051095
Date: 2012-02-09 09:05 -0500
http://bitbucket.org/pypy/pypy/changeset/8f4b87051095/

Log:	added ror to ndarray

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -138,6 +138,7 @@
     descr_rlshift = _binop_right_impl("left_shift")
 
     descr_rand = _binop_right_impl("bitwise_and")
+    descr_ror = _binop_right_impl("bitwise_or")
 
     def descr_rdivmod(self, space, w_other):
         w_quotient = self.descr_rdiv(space, w_other)
@@ -1266,6 +1267,7 @@
     __rlshift__ = interp2app(BaseArray.descr_rlshift),
 
     __rand__ = interp2app(BaseArray.descr_rand),
+    __ror__ = interp2app(BaseArray.descr_ror),
 
     __eq__ = interp2app(BaseArray.descr_eq),
     __ne__ = interp2app(BaseArray.descr_ne),
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
@@ -714,6 +714,13 @@
         a = arange(5)
         assert (3 & a == [0, 1, 2, 3, 0]).all()
 
+    def test_ror(self):
+        from _numpypy import arange
+
+        a = arange(5)
+
+        assert (3 | a == [3, 3, 3, 3, 7]).all()
+
     def test_pos(self):
         from _numpypy import array
         a = array([1., -2., 3., -4., -5.])


More information about the pypy-commit mailing list