mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
gh-96819: multiprocessing.resource_tracker: check if length of pipe write <= 512 (#96890)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
parent
14d4f68ebb
commit
19ca114645
3 changed files with 11 additions and 2 deletions
|
@ -161,10 +161,10 @@ class ResourceTracker(object):
|
|||
def _send(self, cmd, name, rtype):
|
||||
self.ensure_running()
|
||||
msg = '{0}:{1}:{2}\n'.format(cmd, name, rtype).encode('ascii')
|
||||
if len(name) > 512:
|
||||
if len(msg) > 512:
|
||||
# posix guarantees that writes to a pipe of less than PIPE_BUF
|
||||
# bytes are atomic, and that PIPE_BUF >= 512
|
||||
raise ValueError('name too long')
|
||||
raise ValueError('msg too long')
|
||||
nbytes = os.write(self._fd, msg)
|
||||
assert nbytes == len(msg), "nbytes {0:n} but len(msg) {1:n}".format(
|
||||
nbytes, len(msg))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue