bpo-37531: regrtest now catchs ProcessLookupError (GH-16827)

Fix a warning on a race condition on TestWorkerProcess.kill(): ignore
silently ProcessLookupError rather than logging an useless warning.
This commit is contained in:
Victor Stinner 2019-10-17 00:29:12 +02:00 committed by GitHub
parent 7aebbd1182
commit a661392f8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,6 +152,11 @@ def _kill(self):
print(f"Kill {self}", file=sys.stderr, flush=True)
try:
popen.kill()
except ProcessLookupError:
# Process completed, the TestWorkerProcess thread read its exit
# status, but Popen.send_signal() read the returncode just before
# Popen.wait() set returncode.
pass
except OSError as exc:
print_warning(f"Failed to kill {self}: {exc!r}")