You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_curses regression in 3.16.0a1: test_newterm fails on a real terminal that's not 80x25 #159394
The test seems to be written with the wrong assumption that curses will always evaluate the terminal size to 80x25, which fails when tests are run on a real terminal rather than GHA:
======================================================================
FAIL: test_newterm (test.test_curses.ScreenTests.test_newterm)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/portage/dev-lang/python-3.16.0_alpha1/work/Python-3.16.0a1/Lib/test/test_curses.py", line 3336, in test_newtermself.assertEqual(win.getmaxyx(), (24, 80))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: Tuples differ: (24, 135) != (24, 80)
First differing element 1:
135
80
- (24, 135)
+ (24, 80)
----------------------------------------------------------------------
Ran 189 tests in 4.068s
FAILED (failures=1, skipped=4)
The terminal the tests run in does not matter: newterm() is called on a new pseudo-terminal with zero size, so ncurses takes the size from the LINES and COLUMNS environment variables, and from terminfo (24x80 for xterm) only if they are not set. Your environment probably has COLUMNS=135 exported. With LINES=40 COLUMNS=135, SLKTests.test_init_reserves_a_line fails too.
#159665 sets LINES and COLUMNS in these tests, so that every screen they create is 24x80 whatever the environment and the terminfo entry.
Bash (since 5.0, checkwinsize is on by default) updates COLUMNS and LINES from the terminal size after each external command, even in a non-interactive shell, and since COLUMNS is exported the updated value is passed to child processes. So an ebuild run from a 135-column terminal gets COLUMNS=135 despite exporting COLUMNS=80 earlier. LINES is not exported, so ncurses took 24 from terminfo, which matches the (24, 135) in the report.
Activity
serhiy-storchaka commentedon Oct 18, 2026
The terminal the tests run in does not matter:
newterm()is called on a new pseudo-terminal with zero size, so ncurses takes the size from theLINESandCOLUMNSenvironment variables, and from terminfo (24x80 forxterm) only if they are not set. Your environment probably hasCOLUMNS=135exported. WithLINES=40 COLUMNS=135,SLKTests.test_init_reserves_a_linefails too.#159665 sets
LINESandCOLUMNSin these tests, so that every screen they create is 24x80 whatever the environment and the terminfo entry.Merge remote-tracking branch 'upstream/main' into pythongh-159394-new…
mgorny commentedon Oct 18, 2026
Nope, we explicitly export
COLUMNS=80because of some other tests.serhiy-storchaka commentedon Oct 18, 2026
Bash (since 5.0,
checkwinsizeis on by default) updatesCOLUMNSandLINESfrom the terminal size after each external command, even in a non-interactive shell, and sinceCOLUMNSis exported the updated value is passed to child processes. So an ebuild run from a 135-column terminal getsCOLUMNS=135despite exportingCOLUMNS=80earlier.LINESis not exported, so ncurses took 24 from terminfo, which matches the(24, 135)in the report.Thank you for testing the fix.
gh-159394: Fix test_curses when $LINES or $COLUMNS is set (GH-159665)