Skip to content

Commit 6f8e22f

Browse files
committed
clear up some comments and an assert
1 parent ca47b6f commit 6f8e22f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Lib/multiprocessing/forkserver.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def ensure_running(self):
177177
finally:
178178
os.close(alive_r)
179179
os.close(authkey_r)
180-
# Prevent access from processes not in our process tree that
181-
# have the same shared key for this forkserver.
180+
# Authenticate our control socket to prevent access from
181+
# processes we have not shared this key with.
182182
try:
183183
self._forkserver_authkey = os.urandom(_authkey_len)
184184
os.write(authkey_w, self._forkserver_authkey)
@@ -196,10 +196,8 @@ def main(listener_fd, alive_r, preload, main_path=None, sys_path=None,
196196
*, authkey_r=None):
197197
"""Run forkserver."""
198198
if authkey_r is not None:
199-
# If there is no authkey, the parent closes the pipe without writing
200-
# anything resulting in an empty authkey of b'' here.
201199
authkey = os.read(authkey_r, _authkey_len)
202-
assert len(authkey) == _authkey_len or not authkey
200+
assert len(authkey) == _authkey_len, f'{len(authkey)} < {_authkey_len}'
203201
os.close(authkey_r)
204202
else:
205203
authkey = b''

0 commit comments

Comments
 (0)