-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[macOS] test_builtin.PtyTests.test_input_tty
hangs if rlcompleter
is imported
#116402
Comments
Reduced amount of tests to trigger the hang: ./python.exe -m test test___all__ test_builtin
Using random seed: 2282378935
0:00:00 load avg: 1.58 Run 2 tests sequentially
0:00:00 load avg: 1.58 [1/2] test___all__
0:00:00 load avg: 1.58 [2/2] test_builtin
^C
== Tests result: INTERRUPTED ==
1 test omitted:
test_builtin
1 test OK.
Test suite interrupted by signal SIGINT.
Total duration: 18.0 sec
Total tests: run=1
Total test files: run=1/2
Result: INTERRUPTED |
Minimal number of tests:
It gets stuck here: cpython/Lib/test/test_builtin.py Line 2282 in d2f1b0e
|
Since |
I think that it would be easier to bisect when running only two test cases at least! |
If we skip import of diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 19dcbb207e..c5bf4bb1ff 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -111,6 +111,8 @@ def test_all(self):
lib_dir = os.path.dirname(os.path.dirname(__file__))
for path, modname in self.walk_modules(lib_dir, ""):
m = modname
+ if m == "rlcompleter":
+ continue
denied = False
while m:
if m in denylist: ./python.exe -m test test___all__ test_builtin
Using random seed: 1172128194
0:00:00 load avg: 4.37 Run 2 tests sequentially
0:00:00 load avg: 4.37 [1/2] test___all__
0:00:01 load avg: 4.37 [2/2] test_builtin
== Tests result: SUCCESS ==
All 2 tests OK.
Total duration: 1.7 sec
Total tests: run=133 skipped=1
Total test files: run=2/2
Result: SUCCESS |
Seems like problem in this import: try:
import readline
except ImportError:
_readline_available = False
else:
readline.set_completer(Completer().complete)
# Release references early at shutdown (the readline module's
# contents are quasi-immortal, and the completer function holds a
# reference to globals).
atexit.register(lambda: readline.set_completer(None))
_readline_available = True |
If a test fails with a completer callback is set, you can try to:
But only do it if readline is in |
test_builtin
hangs when running the full test suitetest_builtin.PtyTests.test_input_tty
hangs when run after test___all__
I would add a code that restores (or just resets) the completer in |
If you fully want to control the TTY and not be affected by previous tests, another approach is to spawn a new process. |
This might be a duplicate of #89050 |
This test hangs for me on a Mac even without running any other test:
|
test_builtin.PtyTests.test_input_tty
hangs when run after test___all__test_builtin.PtyTests.test_input_tty
hangs if rlcompleter
is imported
What I'm seeing is related to #112950, which made it so I tried locally to temporarily set the readline completer to None as @vstinner suggests above, but the test still hangs. I haven't looked more deeply to figure out what's going wrong. |
If I comment out the import of I see that many similar tests in cpython/Lib/test/test_builtin.py Line 2400 in 64ff1e2
cpython/Lib/test/test_builtin.py Line 2405 in 64ff1e2
cpython/Lib/test/test_builtin.py Line 2415 in 64ff1e2
We could consider doing something similar here, though obviously it would be nice if the test could still be run even if |
test_builtin.PtyTests.test_input_tty
hangs if rlcompleter
is importedtest_builtin.PtyTests.test_input_tty
hangs if rlcompleter
is imported
…onGH-122447) (cherry picked from commit 1d8e453) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Bug report
Bug description:
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
The text was updated successfully, but these errors were encountered: