Skip to content

[pull] main from python:main - #1403

Merged
pull[bot] merged 4 commits into
tj-python:mainfrom
python:main
Aug 23, 2026
Merged

[pull] main from python:main#1403
pull[bot] merged 4 commits into
tj-python:mainfrom
python:main

Conversation

@pull

@pull pull Bot commented Aug 23, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

serhiy-storchaka and others added 4 commits August 23, 2026 14:42
…6235)

Fix wrong types: instr() and getstr() return a bytes object, not a str, and
their n limits the number of bytes; getkey() returns a str; unctrl() returns
a bytes object.  Make clear whether an integer standing for a character is an
encoded byte or a character code.

Rewrite the documentation of getch(), get_wch(), getkey(), getstr(),
get_wstr(), instr(), in_wstr() and in_wchstr(), following X/Open Curses.
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() and get_wstr() are
left as they are.

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.
…H-156262)

The pid_t, Py_off_t, HANDLE, DWORD and BOOL converters were defined in
9 files.  The Py_off_t type and its converter function are now shared too.
DWORD in _winapi is used with bitwise=True to keep accepting negative
values.

The pid_t converter is now used for the pid parameters in the
_remote_debugging module, which were declared as int.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…156282)

instr(), in_wstr() and in_wchstr() clamped the count to 2047 and silently
truncated a longer line, which a pad can have.  A window read cannot return
more than the columns left on the line, in the unit each method counts: cells,
characters, or bytes at CCHARW_MAX characters of MB_CUR_MAX bytes per cell.
Cap the count by that, and read the rest of the line when the count is
omitted, which it now can be.

getstr() and get_wstr() read the keyboard rather than the window, so their
limit stays.
@pull pull Bot locked and limited conversation to collaborators Aug 23, 2026
@pull pull Bot added the ⤵️ pull label Aug 23, 2026
@pull
pull Bot merged commit ca79981 into tj-python:main Aug 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant