From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 6 Jan 2026 16:38:38 +0000 (+0100) Subject: [3.13] gh-143394: filter for turning off automatic margins in test_no_newline (GH... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d8abae57d5ac6f13599851550f81189dc0e1724;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-143394: filter for turning off automatic margins in test_no_newline (GH-143433) (GH-143478) Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Co-authored-by: Ɓukasz Langa --- diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index fe294c44534e..6d80298dd24a 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1465,6 +1465,17 @@ class TestMain(ReplTestCase): safe_patterns.append(r'\x1b\[\?25[hl]') # cursor visibility safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking + # rmam / smam - automatic margins + rmam = curses.tigetstr("rmam") + smam = curses.tigetstr("smam") + if rmam: + safe_patterns.append(re.escape(rmam.decode("ascii"))) + if smam: + safe_patterns.append(re.escape(smam.decode("ascii"))) + if not rmam and not smam: + safe_patterns.append(r'\x1b\[\?7l') # turn off automatic margins + safe_patterns.append(r'\x1b\[\?7h') # turn on automatic margins + # Modern extensions not in standard terminfo - always use patterns safe_patterns.append(r'\x1b\[\?2004[hl]') # bracketed paste mode safe_patterns.append(r'\x1b\[\?12[hl]') # cursor blinking (may be separate)