]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-137928: remove redundant size validation in multiprocessing.heap (GH-137929)
authorAlejandro Cabello Jiménez <33024690+acabelloj@users.noreply.github.com>
Wed, 12 Nov 2025 00:36:43 +0000 (01:36 +0100)
committerGitHub <noreply@github.com>
Wed, 12 Nov 2025 00:36:43 +0000 (00:36 +0000)
remove redundant size check, malloc does it

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Lib/multiprocessing/heap.py

index 6217dfe12689b379f2dad6f1e4bc3bbf6af8f60a..5c835648395f796d44fdda07f7aa3f5bea063b53 100644 (file)
@@ -324,10 +324,6 @@ class BufferWrapper(object):
     _heap = Heap()
 
     def __init__(self, size):
-        if size < 0:
-            raise ValueError("Size {0:n} out of range".format(size))
-        if sys.maxsize <= size:
-            raise OverflowError("Size {0:n} too large".format(size))
         block = BufferWrapper._heap.malloc(size)
         self._state = (block, size)
         util.Finalize(self, BufferWrapper._heap.free, args=(block,))