Closed
Description
Bug report
Bug description:
./python.exe -m test
...many lines
0:05:14 load avg: 4.04 [ 87/472] test_bool
0:05:14 load avg: 4.04 [ 88/472] test_buffer
0:05:15 load avg: 3.80 [ 89/472] test_bufio
0:05:16 load avg: 3.80 [ 90/472] test_builtin
/Users/admin/Projects/cpython/Lib/pty.py:95: DeprecationWarning: This process (pid=47600) is multi-threaded, use of forkpty() may lead to deadlocks in the child.
pid, fd = os.forkpty()
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Eclips4 commentedon Mar 6, 2024
Reduced amount of tests to trigger the hang:
sobolevn commentedon Mar 6, 2024
Minimal number of tests:
It gets stuck here:
cpython/Lib/test/test_builtin.py
Line 2282 in d2f1b0e
sobolevn commentedon Mar 6, 2024
Since
test_all
actually imports all modules and executes them, the problem can be in any module :(sobolevn commentedon Mar 6, 2024
I think that it would be easier to bisect when running only two test cases at least!
Eclips4 commentedon Mar 6, 2024
If we skip import of
rlcompleter
in thetest_all
, then everything will be fine:Eclips4 commentedon Mar 6, 2024
Seems like problem in this import:
(sources of
Lib/rlcompleter.py
)vstinner commentedon Mar 6, 2024
If a test fails with a completer callback is set, you can try to:
But only do it if readline is in
sys.modules
.[-]``test_builtin`` hangs when running the full test suite[/-][+]``test_builtin.PtyTests.test_input_tty`` hangs when run after test___all__[/+]serhiy-storchaka commentedon Mar 6, 2024
test.test_builtin.PtyTests.test_input_tty
can also be affected by other tests that importrlcompleter
, and importingrlcompleter
can also affect other tests. There may be several old issues which will be solved when solve this issue.I would add a code that restores (or just resets) the completer in
Lib/test/libregrtest/save_env.py
.vstinner commentedon Mar 6, 2024
If you fully want to control the TTY and not be affected by previous tests, another approach is to spawn a new process.
ronaldoussoren commentedon Mar 6, 2024
This might be a duplicate of #89050
JelleZijlstra commentedon May 31, 2024
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[/+]3 remaining items
--with-pydebug
enabled #121832test_builtin.PtyTests.test_input_tty
hangs on macOS #122439pythongh-116402: Avoid readline in test_builtin TTY input tests
Merge branch 'main' into pythongh-116402
gh-116402: Avoid readline in test_builtin TTY input tests (GH-122447)
pythongh-116402: Avoid readline in test_builtin TTY input tests (pyth…
[3.13] gh-116402: Avoid readline in test_builtin TTY input tests (GH-…
pythongh-116402: Avoid readline in test_builtin TTY input tests (pyth…
Backport gh-116402: Avoid readline in test_builtin TTY input tests