mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556) (GH-22018)
(cherry picked from commit 475a5fbb56
)
Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
This commit is contained in:
parent
901c2eae6e
commit
ca55ecbf9a
3 changed files with 15 additions and 0 deletions
|
@ -3864,6 +3864,18 @@ class _TestSharedMemory(BaseTestCase):
|
|||
|
||||
sms.close()
|
||||
|
||||
# Test creating a shared memory segment with negative size
|
||||
with self.assertRaises(ValueError):
|
||||
sms_invalid = shared_memory.SharedMemory(create=True, size=-1)
|
||||
|
||||
# Test creating a shared memory segment with size 0
|
||||
with self.assertRaises(ValueError):
|
||||
sms_invalid = shared_memory.SharedMemory(create=True, size=0)
|
||||
|
||||
# Test creating a shared memory segment without size argument
|
||||
with self.assertRaises(ValueError):
|
||||
sms_invalid = shared_memory.SharedMemory(create=True)
|
||||
|
||||
def test_shared_memory_across_processes(self):
|
||||
# bpo-40135: don't define shared memory block's name in case of
|
||||
# the failure when we run multiprocessing tests in parallel.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue