Skip to content

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

Merged
serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-154870-3.14
Aug 23, 2026
Merged

[3.14] gh-154855: Ask non-ncurses curses for one more character (GH-154870)#156284
serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-154870-3.14

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.14.

(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)
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) August 23, 2026 12:55
@serhiy-storchaka
serhiy-storchaka merged commit f6b1201 into python:3.14 Aug 23, 2026
53 checks passed
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