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

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


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r52291:bb3bb626027b
Date: 2012-02-09 09:03 -0500
http://bitbucket.org/pypy/pypy/changeset/bb3bb626027b/

Log:	added rlshift 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
@@ -135,6 +135,7 @@
     descr_rdiv = _binop_right_impl("divide")
     descr_rmod = _binop_right_impl("mod")
     descr_rpow = _binop_right_impl("power")
+    descr_rlshift = _binop_right_impl("left_shift")
 
     descr_rand = _binop_right_impl("bitwise_and")
 
@@ -1262,6 +1263,7 @@
     __rmod__ = interp2app(BaseArray.descr_rmod),
     __rdivmod__ = interp2app(BaseArray.descr_rdivmod),
     __rpow__ = interp2app(BaseArray.descr_rpow),
+    __rlshift__ = interp2app(BaseArray.descr_rlshift),
 
     __rand__ = interp2app(BaseArray.descr_rand),
 
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
@@ -649,6 +649,12 @@
         a = array([1.0])
         raises(TypeError, lambda: a << 2)
 
+    def test_rlshift(self):
+        from _numpypy import arange
+
+        a = arange(3)
+        assert (2 << a == [2, 4, 8]).all()
+
     def test_pow(self):
         from _numpypy import array
         a = array(range(5), float)


More information about the pypy-commit mailing list