[Python-checkins] cpython: Issue #10181: The decision was to raise a buffer error in memory_exit()

stefan.krah python-checkins at python.org
Mon Mar 5 10:51:05 CET 2012


http://hg.python.org/cpython/rev/373f6cdc6d08
changeset:   75414:373f6cdc6d08
parent:      75409:f1441971b621
user:        Stefan Krah <skrah at bytereef.org>
date:        Mon Mar 05 10:45:31 2012 +0100
summary:
  Issue #10181: The decision was to raise a buffer error in memory_exit()
if the view has exported buffers. Make this official by uncommenting
a test case.

files:
  Lib/test/test_buffer.py |  11 ++++++-----
  1 files changed, 6 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -3484,11 +3484,12 @@
                         self.assertEqual(m3[2], ord(b'3'))
                         del m1, m2, m3
 
-        # XXX If m1 has exports, raise BufferError.
-        # x = bytearray(b'123')
-        # with memoryview(x) as m1:
-        #     ex = ndarray(m1)
-        #     m1[0] == ord(b'1')
+        # memoryview.release() fails if the view has exported buffers.
+        x = bytearray(b'123')
+        with self.assertRaises(BufferError):
+            with memoryview(x) as m:
+                ex = ndarray(m)
+                m[0] == ord(b'1')
 
     def test_memoryview_redirect(self):
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list