Skip to content

Commit 11d42bd

Browse files
gh-152325: Gate curses.has_mouse() on the ncurses patch level (GH-152652)
has_mouse() was added to ncurses after the 5.7 release, but the binding guarded it only with NCURSES_MOUSE_VERSION, which 5.7 already defines, so the module failed to compile against ncurses 5.7 (such as the system curses on macOS). Gate it additionally on NCURSES_EXT_FUNCS, which holds the library's patch date. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7718157 commit 11d42bd

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Doc/library/curses.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,8 @@ Mouse
465465

466466
Return ``True`` if the mouse driver has been successfully initialized.
467467

468+
Availability: ncurses 5.8 or later.
469+
468470
.. versionadded:: next
469471

470472

Modules/_cursesmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7041,6 +7041,8 @@ _curses_meta_impl(PyObject *module, int yes)
70417041
}
70427042

70437043
#ifdef NCURSES_MOUSE_VERSION
7044+
/* has_mouse() was added to ncurses after the 5.7 release. */
7045+
#if defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081122
70447046
/*[clinic input]
70457047
_curses.has_mouse
70467048
@@ -7055,6 +7057,7 @@ _curses_has_mouse_impl(PyObject *module)
70557057

70567058
return PyBool_FromLong(has_mouse());
70577059
}
7060+
#endif /* NCURSES_EXT_FUNCS >= 20081122 */
70587061

70597062
/*[clinic input]
70607063
_curses.mouseinterval

Modules/clinic/_cursesmodule.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)