Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-143394: filter for turning off automatic margins in test_no_newline#143433
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking | ||
| # rmam - turn off automatic margins | ||
| rmam = ti.get("rmam") |
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.
I've takenrmam fromhttps://man7.org/linux/man-pages/man5/terminfo.5.html.
@ambv Should I add
enter_am_mode smam SA turn on automatic marginsas well?
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.
Yes, please.
Chris, this didn't fail because the terminfo database can be different between computers depending on where you got it. I've seen IDEs override it, too, to work around issues with their custom built-in terminal emulators. Finally, while (almost) nobody does that, technically the terminfo database is user-editable and even allows addition of custom user-defined capabilities. So we'll likely have to do some whackamole with stuff we missed for a time, but that's alright. I had the same worry with replacingncurses with a hand-rolled terminfo parser, but so far, so good. The only report we got so far there was from NetBSD.
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.
FWIW, my setup is a stock MacOS Tahoe (26.2) running on an M1 MacBook Pro. I don't do framework builds. Tests are run in a normal MacOS Terminal app withTERM defined asxterm256color. While I refer toTERM in my various shell startup files, I do not change its value, nor do I see a file in/etc containingTERM.
Are the Mac buildbots testing framework builds? If so, what kind of terminal environment exists there? Perhaps thepyrepl tests should be run a few times with different (common?) values forTERM.
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.
Chris, this didn't fail because the terminfo database can be different between computers depending on [...]
Thank you for the detailed explanation ❤️
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.
Yet, I do not understand why e.g. CI passed previous to this PR. We didn't do any filtering regarding\033[?7h before, but CI passed. I assume, because in CI and for our build botsis_apple_terminal is false, but obviously on@smontanaro's setup it returns true.
Settingis_apple_terminal manually to true immediately raised the problem for me on WSL and native Ubuntu ...
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.
This is the culprit,@chris-eibl: the Apple Terminal special case. I'll make sure to test that, too, when landing stuff. We can also look into running the maintest_pyrepl stuff twice, the second time withis_apple_terminal mocked to returnTrue. That way we won't regress in the future.
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.
As someone who uses a Mac daily, are there changes to my environment I can make to mimic the environment of the Mac buildbots? I'm happy to add that to my mix. I routinely run tests for main and the two most recent older branches (currently 3.13 & 3.14).
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.
Most probablyis_apple_terminal is false on CI, becauseos.getenv("TERM_PROGRAM") == "Apple_Terminal" does not evaluate to true there, but idk why :(
At least#143461 takes care to enforceApple_Terminal, so your use case is now handled, too.
You can setTERM_PROGRAM to something different thanApple_Terminal to mimic what happened in CI.
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.
You can set TERM_PROGRAM to something different than Apple_Terminal to mimic what happened in CI.
Excellent, I can just run in an xterm. (Hadn't occurred to me before, but then I didn't realize there were these kinds of environment diffs.)
ambv commentedJan 5, 2026
I reproduced the problem with Apple Terminal and can confirm this PR fixes it. |
04ace41 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@chris-eibl for the PR, and@ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…newline (pythonGH-143433)(cherry picked from commit04ace41)Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
GH-143459 is a backport of this pull request to the3.14 branch. |
Thanks@chris-eibl for the PR, and@ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…newline (pythonGH-143433)(cherry picked from commit04ace41)Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
GH-143478 is a backport of this pull request to the3.13 branch. |
Uh oh!
There was an error while loading.Please reload this page.
@smontanaro This should fix your issue.
Sorry, I cannot test because I have no Mac.
Also, I don't know why CI and buildbots did not complain before, see
cpython/Lib/_pyrepl/unix_console.py
Lines 390 to 391 in68fcb95
cpython/Lib/_pyrepl/unix_console.py
Lines 166 to 168 in68fcb95