mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-77894: Fix a crash when the GC breaks a loop containing a memoryview (GH-123898)
Now a memoryview object can only be cleared if there are no buffers that refer it.
This commit is contained in:
parent
00ffdf2736
commit
a1dbf2ea69
4 changed files with 57 additions and 33 deletions
|
@ -2323,12 +2323,10 @@ class AbstractPicklingErrorTests:
|
|||
'PickleBuffer can only be pickled with protocol >= 5')
|
||||
|
||||
def test_non_continuous_buffer(self):
|
||||
if self.pickler is pickle._Pickler:
|
||||
self.skipTest('CRASHES (see gh-122306)')
|
||||
for proto in protocols[5:]:
|
||||
with self.subTest(proto=proto):
|
||||
pb = pickle.PickleBuffer(memoryview(b"foobar")[::2])
|
||||
with self.assertRaises(pickle.PicklingError):
|
||||
with self.assertRaises((pickle.PicklingError, BufferError)):
|
||||
self.dumps(pb, proto)
|
||||
|
||||
def test_buffer_callback_error(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue