[issue11616] reap_children should not use WNOHANG
Antoine Pitrou
report at bugs.python.org
Sun Mar 20 17:48:01 CET 2011
New submission from Antoine Pitrou <pitrou at free.fr>:
Using WNOHANG means that still-running children won't get collected. This seems to defeat the point of reap_children(). This patch seems to work:
diff -r adbdb3e74461 Lib/test/support.py
--- a/Lib/test/support.py Sun Mar 20 17:36:26 2011 +0100
+++ b/Lib/test/support.py Sun Mar 20 17:45:35 2011 +0100
@@ -1294,10 +1294,9 @@ def reap_children():
while True:
try:
# This will raise an exception on Windows. That's ok.
- pid, status = os.waitpid(any_process, os.WNOHANG)
- if pid == 0:
- break
- except:
+ pid, status = os.waitpid(any_process, 0)
+ except OSError:
+ # Either we're on Windows, or no running child remains.
break
@contextlib.contextmanager
----------
components: Tests
messages: 131510
nosy: nnorwitz, pitrou, rosslagerwall
priority: normal
severity: normal
stage: patch review
status: open
title: reap_children should not use WNOHANG
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11616>
_______________________________________
More information about the Python-bugs-list
mailing list