https://github.com/python/cpython/commit/3453362183f083e37ea866a7ae1b34147ffaf81d
commit: 3453362183f083e37ea866a7ae1b34147ffaf81d
branch: main
author: Pablo Galindo Salgado <[email protected]>
committer: pablogsal <[email protected]>
date: 2024-06-12T19:09:25Z
summary:
gh-118908: Protect the REPL subprocess with a timeout in tests (#120408)
files:
M Lib/test/test_pyrepl/test_pyrepl.py
diff --git a/Lib/test/test_pyrepl/test_pyrepl.py
b/Lib/test/test_pyrepl/test_pyrepl.py
index 3167b8473bfe20..41ba5959a1ec34 100644
--- a/Lib/test/test_pyrepl/test_pyrepl.py
+++ b/Lib/test/test_pyrepl/test_pyrepl.py
@@ -8,6 +8,7 @@
from unittest import TestCase, skipUnless
from unittest.mock import patch
from test.support import force_not_colorized
+from test.support import SHORT_TIMEOUT
from .support import (
FakeConsole,
@@ -885,5 +886,9 @@ def run_repl(self, repl_input: str | list[str], env: dict |
None = None) -> tupl
os.close(master_fd)
os.close(slave_fd)
- exit_code = process.wait()
+ try:
+ exit_code = process.wait(timeout=SHORT_TIMEOUT)
+ except subprocess.TimeoutExpired:
+ process.kill()
+ exit_code = process.returncode
return "\n".join(output), exit_code
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]