Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ff35861

Browse filesBrowse files
[3.13] gh-118908: Protect the REPL subprocess with a timeout in tests (GH-120408) (#120430)
(cherry picked from commit 3453362) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
1 parent f723728 commit ff35861
Copy full SHA for ff35861

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎Lib/test/test_pyrepl/test_pyrepl.py

Copy file name to clipboardExpand all lines: Lib/test/test_pyrepl/test_pyrepl.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from unittest import TestCase, skipUnless
99
from unittest.mock import patch
1010
from test.support import force_not_colorized
11+
from test.support import SHORT_TIMEOUT
1112

1213
from .support import (
1314
FakeConsole,
@@ -885,5 +886,9 @@ def run_repl(self, repl_input: str | list[str], env: dict | None = None) -> tupl
885886

886887
os.close(master_fd)
887888
os.close(slave_fd)
888-
exit_code = process.wait()
889+
try:
890+
exit_code = process.wait(timeout=SHORT_TIMEOUT)
891+
except subprocess.TimeoutExpired:
892+
process.kill()
893+
exit_code = process.returncode
889894
return "\n".join(output), exit_code

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.