[pypy-commit] pypy PyBuffer-backport: Don't bother preventing _numpypy.frombuffer() from working on memoryviews

rlamy pypy.commits at gmail.com
Thu May 11 11:58:11 EDT 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: PyBuffer-backport
Changeset: r91255:89ffc4931b4b
Date: 2017-05-11 16:57 +0100
http://bitbucket.org/pypy/pypy/changeset/89ffc4931b4b/

Log:	Don't bother preventing _numpypy.frombuffer() from working on
	memoryviews

diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -3611,8 +3611,6 @@
         import numpy as np
         exc = raises(AttributeError, np.frombuffer, None)
         assert str(exc.value) == "'NoneType' object has no attribute '__buffer__'"
-        exc = raises(AttributeError, np.frombuffer, memoryview(self.data))
-        assert str(exc.value) == "'memoryview' object has no attribute '__buffer__'"
         exc = raises(ValueError, np.frombuffer, self.data, 'S0')
         assert str(exc.value) == "itemsize cannot be zero in type"
         exc = raises(ValueError, np.frombuffer, self.data, offset=-1)
@@ -3684,7 +3682,7 @@
             assert y.format == 'T{b:a:xxxi:b:T{b:f0:i:f1:}:sub:xxxi:c:}'
         else:
             assert y.format == 'T{b:a:xxxi:b:T{b:f0:=i:f1:}:sub:xxx at i:c:}'
- 
+
 
         dt1 = np.dtype(
              [('a', 'b'), ('b', 'i'), ('sub', np.dtype('b,i')), ('c', 'i')],
@@ -3695,7 +3693,7 @@
             assert y.format == 'T{b:a:xxxi:b:T{b:f0:i:f1:}:sub:xxxi:c:}'
         else:
             assert y.format == 'T{b:a:xxxi:b:T{b:f0:=i:f1:}:sub:xxx at i:c:}'
- 
+
 
     def test_fromstring(self):
         import sys


More information about the pypy-commit mailing list