Skip to content

[3.13] gh-152502: Detect the curses mouse interface portably (GH-152705) - #152735

Merged
serhiy-storchaka merged 1 commit into
python:3.13from
serhiy-storchaka:backport-152705-3.13
Jul 1, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.13from
serhiy-storchaka:backport-152705-3.13

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

The mouse interface (getmouse(), the BUTTON* constants, ...) was gated on the ncurses-specific NCURSES_MOUSE_VERSION macro, so it was dropped on other curses implementations that provide it, such as NetBSD curses and PDCurses (the latter underpins windows-curses).

It is now gated on a configure capability probe or the PDCURSES macro. getmouse() is probed with its X/Open getmouse(MEVENT *) signature specifically, because PDCurses declares an incompatible getmouse(void) unless built for the ncurses mouse API; PDC_NCMOUSE is now always defined so PDCurses selects that interface.

The is_*() state-query methods named in the original change (GH-152705) do not exist on 3.13, so only the mouse interface is backported.

Verified by reconfiguring + rebuilding on 3.13 (the probe resolves HAVE_CURSES_GETMOUSE=1) and running test_curses.

(cherry picked from commit 7bbea4f)

…ythonGH-152705)

The mouse interface (getmouse(), the BUTTON* constants, ...) was gated on the
ncurses-specific NCURSES_MOUSE_VERSION macro, so it was dropped on other curses
implementations that provide it, such as NetBSD curses and PDCurses.

Gate it instead on a configure capability probe or the PDCURSES macro.  Probe
for getmouse() with its X/Open getmouse(MEVENT *) signature, since PDCurses
declares an incompatible getmouse(void) unless built for the ncurses mouse API,
which PDC_NCMOUSE now always selects.

The is_*() state-query methods named in the original change do not exist on 3.15,
so only the mouse interface is backported.

(cherry picked from commit 7bbea4f)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka
serhiy-storchaka merged commit 79d2264 into python:3.13 Jul 1, 2026
37 of 40 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the backport-152705-3.13 branch July 1, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant