summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/forkserver.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/multiprocessing/forkserver.py')
-rw-r--r--Lib/multiprocessing/forkserver.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/multiprocessing/forkserver.py b/Lib/multiprocessing/forkserver.py
index 69b842a..7a952e2 100644
--- a/Lib/multiprocessing/forkserver.py
+++ b/Lib/multiprocessing/forkserver.py
@@ -189,7 +189,7 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None):
if alive_r in rfds:
# EOF because no more client processes left
- assert os.read(alive_r, 1) == b''
+ assert os.read(alive_r, 1) == b'', "Not at EOF?"
raise SystemExit
if sig_r in rfds:
@@ -208,7 +208,10 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None):
if os.WIFSIGNALED(sts):
returncode = -os.WTERMSIG(sts)
else:
- assert os.WIFEXITED(sts)
+ if not os.WIFEXITED(sts):
+ raise AssertionError(
+ "Child {0:n} status is {1:n}".format(
+ pid,sts))
returncode = os.WEXITSTATUS(sts)
# Send exit code to client process
try:
@@ -227,7 +230,10 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None):
with listener.accept()[0] as s:
# Receive fds from client
fds = reduction.recvfds(s, MAXFDS_TO_SEND + 1)
- assert len(fds) <= MAXFDS_TO_SEND
+ if len(fds) > MAXFDS_TO_SEND:
+ raise RuntimeError(
+ "Too many ({0:n}) fds to send".format(
+ len(fds)))
child_r, child_w, *fds = fds
s.close()
pid = os.fork()