Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-140482: Preserve and restorestty echo as a test environment#140519

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
warsaw merged 5 commits intopython:mainfromwarsaw:gh140482-terminal-echo
Oct 24, 2025

Conversation

@warsaw
Copy link
Member

@warsawwarsaw commentedOct 23, 2025
edited by bedevere-appbot
Loading

The test suite sometimes turns off terminal echo after it completes. As far as I can tell, it's completely random and probably caused by tests that don't (or can't!) fully clean up after themselves. After implementing this fix and testing it many times withmake test andmake quicktest, I see a common set of tests that it happens in, but no real rhyme or reason.

This patch just saves and restorestermios.ECHO as a saved test environment and in lots of local testing it works perfectly. Yeah, it's just an annoyance but as#140480 says, this has been annoying me for many releases. Thanks to@zware for suggesting a test environment in my abandoned#140482 PR.

I recommend backporting to all active non-security branches as it will help and there should be no risk involved. One caveat is that I did have to change the signature and semantics oftry_get_module() because if the requested module is not already imported,sys.modules[name] will fail, and sincetermios isn't generally imported,try_get_module() would be unhelpful otherwise. The alternative is to importtermios at the top of the module so it's always available, but as no other saved test environment seems to do that, and this environment is global rather than tied to a specific test, I thought this was the better approach. Suggestions welcome.

@warsawwarsaw self-assigned thisOct 23, 2025
@warsawwarsaw added testsTests in the Lib/test dir 3.13bugs and security fixes 3.14bugs and security fixes needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes 3.15new features, bugs and security fixes labelsOct 23, 2025
@warsawwarsaw changed the titlegh-140482: Preserve and restorestty echo as a test environmentgh-140480: Preserve and restorestty echo as a test environmentOct 23, 2025
@warsawwarsaw changed the titlegh-140480: Preserve and restorestty echo as a test environmentgh-140482: Preserve and restorestty echo as a test environmentOct 23, 2025
Copy link
Member

@zwarezware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A few style nits and a question, but LGTM.

@picnixzpicnixz removed 3.13bugs and security fixes 3.14bugs and security fixes 3.15new features, bugs and security fixes labelsOct 24, 2025
@warsawwarsaw merged commitb3c713a intopython:mainOct 24, 2025
59 checks passed
@miss-islington-app
Copy link

Thanks@warsaw for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 24, 2025
…nt (pythonGH-140519)(cherry picked from commitb3c713a)Co-authored-by: Barry Warsaw <barry@python.org>pythongh-140482: Restore `stty echo` as a test environment
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 24, 2025
…nt (pythonGH-140519)(cherry picked from commitb3c713a)Co-authored-by: Barry Warsaw <barry@python.org>pythongh-140482: Restore `stty echo` as a test environment
@bedevere-app
Copy link

GH-140562 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelOct 24, 2025
@bedevere-app
Copy link

GH-140563 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelOct 24, 2025
warsaw added a commit that referenced this pull requestOct 24, 2025
…ent (GH-140519) (#140563)gh-140482: Preserve and restore `stty echo` as a test environment (GH-140519)(cherry picked from commitb3c713a)gh-140482: Restore `stty echo` as a test environmentCo-authored-by: Barry Warsaw <barry@python.org>
warsaw added a commit that referenced this pull requestOct 24, 2025
…ent (GH-140519) (#140562)gh-140482: Preserve and restore `stty echo` as a test environment (GH-140519)(cherry picked from commitb3c713a)gh-140482: Restore `stty echo` as a test environmentCo-authored-by: Barry Warsaw <barry@python.org>
@warsawwarsaw deleted the gh140482-terminal-echo branchOctober 24, 2025 19:24
@vstinner
Copy link
Member

So which tests fail with this additional check?

@vstinner
Copy link
Member

So which tests fail with this additional check?

I reply to myself, Barry already wrote in the issue:

The best I could come up with is test_ssl because that also fails intermittently, and when it fails, it seems to leave the terminal in -echo, but the correlation isn't perfect.

So test_ssl may be the guilty test.

At least, we will know which tests change the terminal to-echo with the new change.

warsaw reacted with thumbs up emoji

@warsaw
Copy link
MemberAuthor

So test_ssl may be the guilty test.

Just for completeness, it is but other tests also change the environment, e.g.test_remote_pdb

vstinner reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner left review comments

@zwarezwarezware approved these changes

Assignees

@warsawwarsaw

Labels

testsTests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@warsaw@vstinner@zware@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp