-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 taken rmam from https://man7.org/linux/man-pages/man5/terminfo.5.html.
@ambv Should I add
enter_am_mode smam SA turn on automatic margins
as 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 replacing ncurses 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 with TERM defined as xterm256color. While I refer to TERM in my various shell startup files, I do not change its value, nor do I see a file in /etc containing TERM.
Are the Mac buildbots testing framework builds? If so, what kind of terminal environment exists there? Perhaps the pyrepl tests should be run a few times with different (common?) values for TERM.
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 bots is_apple_terminal is false, but obviously on @smontanaro's setup it returns true.
Setting is_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 main test_pyrepl stuff twice, the second time with is_apple_terminal mocked to return True. 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 probably is_apple_terminal is false on CI, because os.getenv("TERM_PROGRAM") == "Apple_Terminal" does not evaluate to true there, but idk why :(
At least #143461 takes care to enforce Apple_Terminal, so your use case is now handled, too.
You can set TERM_PROGRAM to something different than Apple_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.)
|
I reproduced the problem with Apple Terminal and can confirm this PR fixes it. |
|
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 commit 04ace41) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
|
GH-143459 is a backport of this pull request to the 3.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 commit 04ace41) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
|
GH-143478 is a backport of this pull request to the 3.13 branch. |
@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 in 68fcb95
cpython/Lib/_pyrepl/unix_console.py
Lines 166 to 168 in 68fcb95