diff options
author | Vinay Sharma <vinay04sharma@icloud.com> | 2020-08-30 19:03:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-30 19:03:11 (GMT) |
commit | 475a5fbb5644ea200c990d85d8c264e78ab6c7ea (patch) | |
tree | 1cd22d91459b1a69555210acc0255895c71c7302 /Lib/test/_test_multiprocessing.py | |
parent | 582f13786bb75c73d609790967fea03a5b50148a (diff) | |
download | cpython-475a5fbb5644ea200c990d85d8c264e78ab6c7ea.zip cpython-475a5fbb5644ea200c990d85d8c264e78ab6c7ea.tar.gz cpython-475a5fbb5644ea200c990d85d8c264e78ab6c7ea.tar.bz2 |
bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556)
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 6a0e101..fd3b430 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3880,6 +3880,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. |