Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

test_curses failures on Python 3.16.0a1 with ncurses 6.6 on openSUSE #159579

Open

Description

@mcepl

Bug report

Description

Building Python 3.16.0a1 as an openSUSE RPM fails during the test suite because of failures in test_curses. The failures occur both in the initial run and when the test runner reruns the failed tests.

Environment

  • Python 3.16.0a1, built from Python-3.16.0a1.tar.xz
  • openSUSE OBS build environment, Linux x86_64
  • ncurses package version 6.6.20260926-115.1
  • TERM=linux
  • _curses compiled with -I/usr/include/ncursesw and linked with -lncursesw
  • Distribution patches applied. I have not yet reproduced this with an unpatched upstream checkout.

The tests report:

ncurses_version = curses.ncurses_version(major=6, minor=6, patch=20260926)

How the tests were run

The RPM's %check step runs make test with options including:

-u curses,-network -v -i test_freeze_simple_script --timeout=5400

The invocation also excludes some distribution-selected tests.

Failures

The failures fall into several groups. I do not know whether they share a cause.

Input and input pushback

test_get_wstr returns an empty string instead of the queued input:

FAIL: test_get_wstr (test.test_curses.TestCurses.test_get_wstr) (s='Lorem')
  File "Lib/test/test_curses.py", line 1352, in test_get_wstr
    self.assertEqual(win.get_wstr(0, 0), s)
AssertionError: '' != 'Lorem'

test_getstr fails while pushing input:

ERROR: test_getstr (test.test_curses.TestCurses.test_getstr)
  File "Lib/test/test_curses.py", line 1324, in test_getstr
    curses.ungetch(c)
curses.error: unget_wch() (called by ungetch()) returned ERR

The source routes string arguments to ungetch() through unget_wch(), while test_getch pushes strings and reads them using getch(). Could this contribute to these failures?

On the rerun, textbox input tests also fail with:

curses.error: wget_wch() (called by get_wch()): no input

Some input failures may be secondary to unread input left by earlier failed tests.

Textbox lower-right cell

The final character is missing in several textbox tests:

test_textbox_fill_last_cell:
AssertionError: 'abc ' != 'abcd'

test_textbox_fill_last_cell_insert_mode:
AssertionError: 'abc ' != 'abcd'

test_textbox_fill_last_cell_multiline:
AssertionError: 'abc\nde \n' != 'abc\ndef\n'

test_textbox_fill_last_cell_scrollok:
AssertionError: 'abc\nde \n' != 'abc\ndef\n'

Textbox._insert_printable_char() uses insch() for the lower-right cell.

WACS constants

test_wacs_in_cell_methods fails when reading back WACS_DIAMOND:

  File "Lib/test/test_curses.py", line 617, in test_wacs_in_cell_methods
    self.assertEqual(stdscr.in_wch(1, 0), curses.WACS_DIAMOND)
AssertionError: curses.complexchar('E', attr=1162149888, pair=69) != <curses.complexchar object at 0x7f4252bc49c0>

On the rerun, test_wacs_line_constants also raises the following for D_TTEE, T_ULCORNER, and T_URCORNER:

curses.error: getcchar() returned ERR

Overall result

1 test failed:
    test_curses

467 tests OK.

Total tests: run=51,162 (filtered) failures=29 skipped=2,517
Total test files: run=541/549 (filtered) failed=1 skipped=72 resource_denied=9 rerun=1
Result: FAILURE

Related feature work includes #152233 and #155863. I have not found an existing report matching these failures.

CPython versions tested on:

3.16

Operating systems tested on:

Linux

Activity

  1. added
    type-bug
    on Oct 16, 2026
  2. added
    build
    extension-modules
    and removed
    build
    on Oct 16, 2026
  3. picnixz commented on Oct 16, 2026

    @picnixz
    Member
  4. serhiy-storchaka commented on Oct 18, 2026

    @serhiy-storchaka
    Member

    Thank you for the detailed report, @mcepl. I reproduced all of these on openSUSE Tumbleweed with libncurses6-6.6.20260926-115.1. None of them is a bug in Python; there are three separate causes:

    • The lower-right Textbox cell (test_textbox_fill_last_cell*): a regression in ncurses 6.6-20260815, still present in 20261017. insch() and ins_wch() in the last column of a line insert nothing and return OK, and Textbox writes its lower-right cell with insch(). Reported in https://lists.gnu.org/archive/html/bug-ncurses/2026-10/msg00007.html.
    • The WACS constants (test_wacs_*): since ncurses 6.6-20260523, only the first screen gets a table of wide ACS characters, and it is freed with that screen. In a reentrant build like openSUSE's, the WACS_* constants then point to freed memory; in other builds they become NULL. Reported in https://lists.gnu.org/archive/html/bug-ncurses/2026-10/msg00008.html.
    • The input tests (test_getch, test_getstr, test_get_wstr, the Textbox editing tests), which fail only in UTF-8 locales: openSUSE's FORTIFY_SOURCE_3-fix.patch makes unget_wch() push back MB_CUR_MAX bytes per character, so each character is followed by five uninitialized bytes. The failures on rerun follow from the garbage left in the input queue. Reported in https://bugzilla.opensuse.org/show_bug.cgi?id=1285901.

    On the current main branch, test_resizeterm can also fail after the soft-label tests. That is an older ncurses bug, which is now visible because curses.LINES is taken from the size of stdscr. Reported in https://lists.gnu.org/archive/html/bug-ncurses/2026-10/msg00009.html.

  5. mcepl commented on Oct 23, 2026

    @mcepl
    ContributorAuthor

    @serhiy-storchaka thank you very much

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

Metadata

Metadata

Labels

OS-linuxbuildextension-modulestopic-cursestype-bug

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions