Skip to content

[3.15] gh-154855: Ask non-ncurses curses for one more character (GH-154870) - #156283

Open
serhiy-storchaka wants to merge 1 commit into
python:3.15from
serhiy-storchaka:backport-154870-3.15
Open

[3.15] gh-154855: Ask non-ncurses curses for one more character (GH-154870)#156283
serhiy-storchaka wants to merge 1 commit into
python:3.15from
serhiy-storchaka:backport-154870-3.15

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 23, 2026

Copy link
Copy Markdown
Member

Manual backport of #154870.

Passing n to the library is ncurses' reading of n: it stores n characters and adds a terminator. NetBSD curses counts the terminator in n.

Ask a library that is neither ncurses nor PDCurses for n + 1, and read again if it stored more than asked; truncating could split a multibyte character. This is not possible for input, so getstr() is left as it is.

instr() now takes the length from the value returned by winnstr(), as X/Open specifies, instead of searching for a terminator which it does not.

Only instr() is affected here: in_wstr() and in_wchstr() do not exist in 3.15.

(cherry picked from commit 43a1869)

…pythonGH-154870)

Passing n to the library is ncurses' reading of n: it stores n characters
and adds a terminator.  NetBSD curses counts the terminator in n.

Ask a library that is neither ncurses nor PDCurses for n + 1, and read
again if it stored more than asked; truncating could split a multibyte
character.  This is not possible for input, so getstr() is left as it is.

instr() now takes the length from the value returned by winnstr(), as
X/Open specifies, instead of searching for a terminator which it does not.

(cherry picked from commit 43a1869)
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