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:
Miss Islington (bot) 2020-08-30 12:42:22 -07:00 committed by GitHub
parent 901c2eae6e
commit ca55ecbf9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View file

@ -76,6 +76,8 @@ def __init__(self, name=None, create=False, size=0):
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")