https://github.com/python/cpython/commit/df6676549cd67c7b83111c6fce7c546270604aa6
commit: df6676549cd67c7b83111c6fce7c546270604aa6
branch: main
author: Alejandro Cabello JimĂ©nez <[email protected]>
committer: gpshead <[email protected]>
date: 2025-11-12T00:36:43Z
summary:

gh-137928: remove redundant size validation in multiprocessing.heap (GH-137929)

remove redundant size check, malloc does it

---------

Co-authored-by: Gregory P. Smith <[email protected]>

files:
M Lib/multiprocessing/heap.py

diff --git a/Lib/multiprocessing/heap.py b/Lib/multiprocessing/heap.py
index 6217dfe12689b3..5c835648395f79 100644
--- a/Lib/multiprocessing/heap.py
+++ b/Lib/multiprocessing/heap.py
@@ -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,))

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to