diff options
Diffstat (limited to 'Modules/readline.c')
-rw-r--r-- | Modules/readline.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 64935c6..5053d1c 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -412,6 +412,24 @@ PyDoc_STRVAR(doc_get_line_buffer, return the current contents of the line buffer."); +#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER + +/* Exported function to clear the current history */ + +static PyObject * +py_clear_history(PyObject *self, PyObject *noarg) +{ + clear_history(); + Py_INCREF(Py_None); + return Py_None; +} + +PyDoc_STRVAR(doc_clear_history, +"clear_history() -> None\n\ +Clear the current readline history."); +#endif + + /* Exported function to insert text into the line buffer */ static PyObject * @@ -484,6 +502,9 @@ static struct PyMethodDef readline_methods[] = {"set_pre_input_hook", set_pre_input_hook, METH_VARARGS, doc_set_pre_input_hook}, #endif +#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER + {"clear_history", py_clear_history, METH_NOARGS, doc_clear_history}, +#endif {0, 0} }; |