summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_buffer.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_buffer.py')
-rw-r--r--Lib/test/test_buffer.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py
index 2c65ae8..94fc9d4 100644
--- a/Lib/test/test_buffer.py
+++ b/Lib/test/test_buffer.py
@@ -4749,6 +4749,19 @@ class TestPythonBufferProtocol(unittest.TestCase):
c.clear()
self.assertIs(c.buffer, None)
+ def test_release_buffer_with_exception_set(self):
+ class A:
+ def __buffer__(self, flags):
+ return memoryview(bytes(8))
+ def __release_buffer__(self, view):
+ pass
+
+ b = bytearray(8)
+ with memoryview(b):
+ # now b.extend will raise an exception due to exports
+ with self.assertRaises(BufferError):
+ b.extend(A())
+
if __name__ == "__main__":
unittest.main()