]> granicus.if.org Git - python/commitdiff
bpo-37531: regrtest now catchs ProcessLookupError (GH-16827)
authorVictor Stinner <vstinner@python.org>
Wed, 16 Oct 2019 22:29:12 +0000 (00:29 +0200)
committerGitHub <noreply@github.com>
Wed, 16 Oct 2019 22:29:12 +0000 (00:29 +0200)
Fix a warning on a race condition on TestWorkerProcess.kill(): ignore
silently ProcessLookupError rather than logging an useless warning.

Lib/test/libregrtest/runtest_mp.py

index 71db8d69668599483704cec4609eb06f3c8a0069..8026de187d587a960c718f91096fce8b3baecb3a 100644 (file)
@@ -152,6 +152,11 @@ class TestWorkerProcess(threading.Thread):
         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}")