Skip to content

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

Merged
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-152705-3.15
Jun 30, 2026
Merged

[3.15] gh-152502: Detect the curses mouse interface portably (GH-152705)#152707
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-152705-3.15

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.15, so only the mouse interface is backported.

Verified by reconfiguring + rebuilding on 3.15 (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>
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 83391ceff61bdc5d0ba994cdae23f1406885825c 3.14

@serhiy-storchaka serhiy-storchaka deleted the backport-152705-3.15 branch June 30, 2026 20:59
@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 83391ceff61bdc5d0ba994cdae23f1406885825c 3.13

@serhiy-storchaka serhiy-storchaka removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jun 30, 2026
@serhiy-storchaka serhiy-storchaka removed their assignment Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant