summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBatuhan Taşkaya <47358913+isidentical@users.noreply.github.com>2020-03-03 02:00:10 (GMT)
committerGitHub <noreply@github.com>2020-03-03 02:00:10 (GMT)
commit4991cf47c487500fdedc34f0a2eb4b7468a67c3c (patch)
tree21fb11ca1432b0403c8fc4532ed5a5544de86a33
parent6daa37fd42c5d5300172728e8b4de74fe0b319fc (diff)
downloadcpython-4991cf47c487500fdedc34f0a2eb4b7468a67c3c.zip
cpython-4991cf47c487500fdedc34f0a2eb4b7468a67c3c.tar.gz
cpython-4991cf47c487500fdedc34f0a2eb4b7468a67c3c.tar.bz2
bpo-39802: Only expose set_escdelay and set_tabsize when curses extensions are activated (GH-18705)
-rw-r--r--Modules/_cursesmodule.c6
-rw-r--r--Modules/clinic/_cursesmodule.c.h34
2 files changed, 39 insertions, 1 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 5b29000..ee33107 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -3255,6 +3255,9 @@ _curses_setupterm_impl(PyObject *module, const char *term, int fd)
Py_RETURN_NONE;
}
+#if defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102
+// https://invisible-island.net/ncurses/NEWS.html#index-t20080119
+
/*[clinic input]
_curses.get_escdelay
@@ -3334,6 +3337,7 @@ _curses_set_tabsize_impl(PyObject *module, int size)
return PyCursesCheckERR(set_tabsize(size), "set_tabsize");
}
+#endif
/*[clinic input]
_curses.intrflush
@@ -4508,8 +4512,10 @@ static PyMethodDef PyCurses_methods[] = {
_CURSES_RESIZETERM_METHODDEF
_CURSES_RESIZE_TERM_METHODDEF
_CURSES_SAVETTY_METHODDEF
+#if defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102
_CURSES_GET_ESCDELAY_METHODDEF
_CURSES_SET_ESCDELAY_METHODDEF
+#endif
_CURSES_GET_TABSIZE_METHODDEF
_CURSES_SET_TABSIZE_METHODDEF
_CURSES_SETSYX_METHODDEF
diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h
index f3780f8..50d7f21 100644
--- a/Modules/clinic/_cursesmodule.c.h
+++ b/Modules/clinic/_cursesmodule.c.h
@@ -3040,6 +3040,8 @@ exit:
return return_value;
}
+#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)
+
PyDoc_STRVAR(_curses_get_escdelay__doc__,
"get_escdelay($module, /)\n"
"--\n"
@@ -3062,6 +3064,10 @@ _curses_get_escdelay(PyObject *module, PyObject *Py_UNUSED(ignored))
return _curses_get_escdelay_impl(module);
}
+#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */
+
+#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)
+
PyDoc_STRVAR(_curses_set_escdelay__doc__,
"set_escdelay($module, ms, /)\n"
"--\n"
@@ -3102,6 +3108,10 @@ exit:
return return_value;
}
+#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */
+
+#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)
+
PyDoc_STRVAR(_curses_get_tabsize__doc__,
"get_tabsize($module, /)\n"
"--\n"
@@ -3123,6 +3133,10 @@ _curses_get_tabsize(PyObject *module, PyObject *Py_UNUSED(ignored))
return _curses_get_tabsize_impl(module);
}
+#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */
+
+#if (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102)
+
PyDoc_STRVAR(_curses_set_tabsize__doc__,
"set_tabsize($module, size, /)\n"
"--\n"
@@ -3162,6 +3176,8 @@ exit:
return return_value;
}
+#endif /* (defined(NCURSES_EXT_FUNCS) && NCURSES_EXT_FUNCS >= 20081102) */
+
PyDoc_STRVAR(_curses_intrflush__doc__,
"intrflush($module, flag, /)\n"
"--\n"
@@ -4638,6 +4654,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) */
@@ -4681,4 +4713,4 @@ _curses_use_default_colors(PyObject *module, PyObject *Py_UNUSED(ignored))
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
-/*[clinic end generated code: output=0ca4f95323c5d585 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b53652f8acafd817 input=a9049054013a1b77]*/