Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r52244:4412e08f0167
Date: 2012-02-08 11:01 -0500
http://bitbucket.org/pypy/pypy/changeset/4412e08f0167/
Log: added __and__ to numpy boxes
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
@@ -82,6 +82,8 @@
descr_div = _binop_impl("divide")
descr_truediv = _binop_impl("true_divide")
descr_pow = _binop_impl("power")
+ descr_and = _binop_right_impl("bitwise_and")
+
descr_eq = _binop_impl("equal")
descr_ne = _binop_impl("not_equal")
descr_lt = _binop_impl("less")
@@ -178,6 +180,7 @@
__div__ = interp2app(W_GenericBox.descr_div),
__truediv__ = interp2app(W_GenericBox.descr_truediv),
__pow__ = interp2app(W_GenericBox.descr_pow),
+ __and__ = interp2app(W_GenericBox.descr_and),
__radd__ = interp2app(W_GenericBox.descr_radd),
__rsub__ = interp2app(W_GenericBox.descr_rsub),
diff --git a/pypy/module/micronumpy/test/test_dtypes.py
b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -408,3 +408,5 @@
assert truediv(int_(3), int_(2)) == float64(1.5)
assert 2 ** int_(3) == int_(8)
+ assert int_(3) & int_(1) == int_(1)
+ raises(TypeError, lambda: float64(3) & 1)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit