Author: Brian Kearns <[email protected]>
Branch:
Changeset: r68412:63b12bac9e29
Date: 2013-12-12 21:28 -0500
http://bitbucket.org/pypy/pypy/changeset/63b12bac9e29/
Log: fix buffer(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
@@ -1177,6 +1177,7 @@
__int__ = interp2app(W_NDimArray.descr_int),
__long__ = interp2app(W_NDimArray.descr_long),
__float__ = interp2app(W_NDimArray.descr_float),
+ __buffer__ = interp2app(W_NDimArray.descr_get_data),
__pos__ = interp2app(W_NDimArray.descr_pos),
__neg__ = interp2app(W_NDimArray.descr_neg),
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
@@ -320,6 +320,12 @@
e = d.repeat(3, 0)
assert e.shape == (9, 4, 0)
+ def test_buffer(self):
+ import numpy as np
+ a = np.array([1,2,3])
+ b = buffer(a)
+ assert type(b) is buffer
+
def test_type(self):
from numpypy import array
ar = array(range(5))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit