diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst index 1201e8972d..50a59b1893 100644 --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -516,6 +516,7 @@ The module :mod:`curses` defines the following functions: Retrieves the value set by :func:`set_escdelay`. .. versionadded:: 3.9 + .. availability:: not available with stock AIX .. function:: set_escdelay(ms) @@ -524,12 +525,14 @@ The module :mod:`curses` defines the following functions: keyboard from escape sequences sent by cursor and function keys. .. versionadded:: 3.9 + .. availability:: not available with stock AIX .. function:: get_tabsize() Retrieves the value set by :func:`set_tabsize`. .. versionadded:: 3.9 + .. availability:: not available with stock AIX .. function:: set_tabsize(size) @@ -537,6 +540,7 @@ The module :mod:`curses` defines the following functions: character to spaces as it adds the tab to a window. .. versionadded:: 3.9 + .. availability:: not available with stock AIX .. function:: setsyx(y, x) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index 5e619d1383..d50d2853ec 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -261,10 +261,11 @@ class TestCurses(unittest.TestCase): curses.putp(b'abc') curses.qiflush() curses.raw() ; curses.raw(1) - curses.set_escdelay(25) - self.assertEqual(curses.get_escdelay(), 25) - curses.set_tabsize(4) - self.assertEqual(curses.get_tabsize(), 4) + if hasattr(curses, 'set_escdalay'): + curses.set_escdelay(25) + self.assertEqual(curses.get_escdelay(), 25) + curses.set_tabsize(4) + self.assertEqual(curses.get_tabsize(), 4) if hasattr(curses, 'setsyx'): curses.setsyx(5,5) curses.tigetflag('hc') diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index c2ce3a968f..e65f50adab 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -3255,6 +3255,10 @@ _curses_setupterm_impl(PyObject *module, const char *term, int fd) Py_RETURN_NONE; } +#if !defined(_AIX) || defined(NCURSES_VERSION) +/* bpo-39020 - stock AIX curses does not include ESCDELAY + * a third-party addtion of (gnu) ncurses might + */ /*[clinic input] _curses.get_escdelay @@ -3334,6 +3338,7 @@ _curses_set_tabsize_impl(PyObject *module, int size) return PyCursesCheckERR(set_tabsize(size), "set_tabsize"); } +#endif /*[clinic input] _curses.intrflush diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h index f3780f8e01..a9031781f9 100644 --- a/Modules/clinic/_cursesmodule.c.h +++ b/Modules/clinic/_cursesmodule.c.h @@ -3040,6 +3040,10 @@ exit: return return_value; } +#if !defined(_AIX) || defined(NCURSES_VERSION) +/* bpo-39020 - stock AIX curses does not include ESCDELAY + * a third-party addtion of (gnu) ncurses might + */ PyDoc_STRVAR(_curses_get_escdelay__doc__, "get_escdelay($module, /)\n" "--\n" @@ -3161,6 +3165,7 @@ _curses_set_tabsize(PyObject *module, PyObject *arg) exit: return return_value; } +#endif PyDoc_STRVAR(_curses_intrflush__doc__, "intrflush($module, flag, /)\n" @@ -4638,6 +4643,22 @@ _curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored)) #define _CURSES_HAS_KEY_METHODDEF #endif /* !defined(_CURSES_HAS_KEY_METHODDEF) */ +#ifndef _CURSES_GET_ESCDELAY_METHODDEF + #define _CURSES_GET_ESCDELAY_METHODDEF +#endif /* !defined(_CURSES_GET_ESCDELAY_METHODDEF) */ + +#ifndef _CURSES_SET_ESCDELAY_METHODDEF + #define _CURSES_SET_ESCDELAY_METHODDEF +#endif /* !defined(_CURSES_SET_ESCDELAY_METHODDEF) */ + +#ifndef _CURSES_GET_TABSIZE_METHODDEF + #define _CURSES_GET_TABSIZE_METHODDEF +#endif /* !defined(_CURSES_GET_TABSIZE_METHODDEF) */ + +#ifndef _CURSES_SET_TABSIZE_METHODDEF + #define _CURSES_SET_TABSIZE_METHODDEF +#endif /* !defined(_CURSES_SET_TABSIZE_METHODDEF) */ + #ifndef _CURSES_IS_TERM_RESIZED_METHODDEF #define _CURSES_IS_TERM_RESIZED_METHODDEF #endif /* !defined(_CURSES_IS_TERM_RESIZED_METHODDEF) */