summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorVinay Sharma <vinay04sharma@icloud.com>2020-08-30 19:03:11 (GMT)
committerGitHub <noreply@github.com>2020-08-30 19:03:11 (GMT)
commit475a5fbb5644ea200c990d85d8c264e78ab6c7ea (patch)
tree1cd22d91459b1a69555210acc0255895c71c7302 /Lib/multiprocessing
parent582f13786bb75c73d609790967fea03a5b50148a (diff)
downloadcpython-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/multiprocessing')
-rw-r--r--Lib/multiprocessing/shared_memory.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/multiprocessing/shared_memory.py b/Lib/multiprocessing/shared_memory.py
index a3a5fcf..122b3fc 100644
--- a/Lib/multiprocessing/shared_memory.py
+++ b/Lib/multiprocessing/shared_memory.py
@@ -76,6 +76,8 @@ class SharedMemory:
raise ValueError("'size' must be a positive integer")
if create:
self._flags = _O_CREX | os.O_RDWR
+ if size == 0:
+ raise ValueError("'size' must be a positive number different from zero")
if name is None and not self._flags & os.O_EXCL:
raise ValueError("'name' can only be None if create=True")