mirror of
https://github.com/python/cpython.git
synced 2025-10-28 20:25:04 +00:00
[3.13] gh-126980: Fix bytearray.__buffer__ crash on PyBUF_{READ,WRITE} (GH-126981) (#127023)
(cherry picked from commit 3932e1db53)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
dd222a4d47
commit
3fae84fe58
3 changed files with 15 additions and 4 deletions
|
|
@ -4439,6 +4439,14 @@ def test_issue_7385(self):
|
|||
x = ndarray([1,2,3], shape=[3], flags=ND_GETBUF_FAIL)
|
||||
self.assertRaises(BufferError, memoryview, x)
|
||||
|
||||
def test_bytearray_release_buffer_read_flag(self):
|
||||
# See https://github.com/python/cpython/issues/126980
|
||||
obj = bytearray(b'abc')
|
||||
with self.assertRaises(SystemError):
|
||||
obj.__buffer__(inspect.BufferFlags.READ)
|
||||
with self.assertRaises(SystemError):
|
||||
obj.__buffer__(inspect.BufferFlags.WRITE)
|
||||
|
||||
@support.cpython_only
|
||||
def test_pybuffer_size_from_format(self):
|
||||
# basic tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue