Skip to content

Commit e3c7977

Browse files
committed
Update comments
1 parent 6ba7465 commit e3c7977

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Lib/subprocess.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,8 +2152,9 @@ def _wait_kqueue(self, timeout):
21522152
events = kq.control([kev], 1, timeout) # wait
21532153
except OSError as err: # should never happen
21542154
return False
2155-
if not events:
2156-
raise TimeoutExpired(self.args, timeout)
2155+
else:
2156+
if not events:
2157+
raise TimeoutExpired(self.args, timeout)
21572158
return True
21582159
finally:
21592160
kq.close()
@@ -2177,8 +2178,8 @@ def _wait(self, timeout):
21772178
# Try efficient wait first.
21782179
if self._wait_pidfd(timeout) or self._wait_kqueue(timeout):
21792180
# Process is gone. At this point os.waitpid(pid, 0)
2180-
# will return immediately, but in very rare races
2181-
# the PID may have been reused.
2181+
# will return immediately, but in rare races (e.g.
2182+
# long running processes) the PID may have been reused.
21822183
# os.waitpid(pid, WNOHANG) ensures we attempt a
21832184
# non-blocking reap without blocking indefinitely.
21842185
with self._waitpid_lock:

Lib/test/test_subprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4105,8 +4105,8 @@ class FastWaitTestCase(BaseTestCase):
41054105
CAN_USE_KQUEUE = subprocess._CAN_USE_KQUEUE
41064106

41074107
def assert_fast_waitpid_error(self, patch_point):
4108-
# Emulate a case where pidfd_open() (Linux) or kqueue()
4109-
# (BSD/macOS) fails. Busy-poll wait should be used as fallback.
4108+
# Emulate a case where pidfd_open() or kqueue() fails.
4109+
# Busy-poll wait should be used as fallback.
41104110
exc = OSError(errno.EMFILE, os.strerror(errno.EMFILE))
41114111
with mock.patch(patch_point, side_effect=exc) as m:
41124112
p = subprocess.Popen([sys.executable,

0 commit comments

Comments
 (0)