Issue #14181: Preserve backwards compatibility for getbufferprocs that a) do

not adhere to the new documentation and b) manage to clobber view->obj before
returning failure.
This commit is contained in:
Stefan Krah 2012-03-05 17:45:17 +01:00
parent bf6c7eca43
commit 1649c1b33a
3 changed files with 23 additions and 16 deletions

View file

@ -3609,6 +3609,12 @@ class TestBufferProtocol(unittest.TestCase):
lst=lst)
del x, y, z, m
def test_memoryview_getbuffer_undefined(self):
# getbufferproc does not adhere to the new documentation
nd = ndarray([1,2,3], [3], flags=ND_GETBUF_FAIL|ND_GETBUF_UNDEFINED)
self.assertRaises(BufferError, memoryview, nd)
def test_issue_7385(self):
x = ndarray([1,2,3], shape=[3], flags=ND_GETBUF_FAIL)
self.assertRaises(BufferError, memoryview, x)