Skip to content

gh-155877: Reject a NUL cell in curses.complexstr() from an iterable - #159634

Open
fedonman wants to merge 1 commit into
python:mainfrom
fedonman:fix-curses-complexstr-nul-cell
Open

fedonman wants to merge 1 commit into
python:mainfrom
fedonman:fix-curses-complexstr-nul-cell

Conversation

@fedonman

@fedonman fedonman commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GH-156158 rejects a NUL in curses.complexstr() built from a str, but not from an iterable, so complexstr([complexchar('\0'), complexchar('B')]) from the issue still builds and addstr() drops every cell after the NUL. This adds the same check to curses_pack_cell(), which packs the items of an iterable, so a NUL item now raises ValueError: embedded null character too.

$ ./python -m test test_curses -u curses -m test_cell_null_char -v
test_cell_null_char (test.test_curses.TestCurses.test_cell_null_char) ... ok

$ ./python -m test test_curses -u curses
Total tests: run=189 skipped=4
Total test files: run=1/1
Result: SUCCESS

No NEWS entry: the cell API has not been released.

…rable

pythonGH-156158 rejected a NUL in complexstr() given a str, but the iterable
path packed each item without that check, so the example from the issue
still built and addstr() dropped every cell after the NUL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant