-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-116402: Avoid readline in test_builtin TTY input tests #122447
Conversation
@Eclips4, can you confirm this fixes the issue for you? |
Yes! Thanks for the fix! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this also fixes test_builtin
for me locally.
All buildbots (including refleaks and bigmem) passed save for "iOS ARM64 Simulator" with an unrelated failure. Rebasing on main with the |
Thanks @ambv for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…onGH-122447) (cherry picked from commit 1d8e453) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
GH-122472 is a backport of this pull request to the 3.13 branch. |
The intention here is to make the TTY
input()
tests run in as many scenarios as possible. For this to happen, we need to temporarily remove the function pointer set tocall_readline
inPyInit_readline()
. This pointer is normallyNULL
withoutreadline
andPyOS_Readline
uses a basic implementation of its own in this case. This is what we want.We could try and avoid importing
readline
in tests, but we have played this whack-a-mole for a long time. For instance, now thatpdb
usesrlcompleter
,test_builtin
imports that always (since it importsdoctest
inload_tests()
anddoctest
importspdb
as it subclasses it). I think we should stop trying to not loadreadline
, and just detach its function temporarily. This avoids discussions of "unimporting" readline, which would be problematic asPyInit_readline()
sets global state on the C side throughsetup_readline
.While CI is famously not run with a TTY and those tests will be skipped there, people running tests sequentially from their terminal will now be able to have those tests run in many more situations than before.
I did the function pointer unsetting with
ctypes
for simplicity. If that's unavailable, the context manager simply skips the tests.test_builtin.PtyTests.test_input_tty
hangs ifrlcompleter
is imported #116402