diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-09-20 16:08:33 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-09-20 16:08:33 (GMT) |
commit | e7a9796a0f83bd2e5e2b1d35ad8f0a2a96ec5e3f (patch) | |
tree | ffe4c8f50a81591e0fb8a9e7354b2d6b2678ea31 /Modules/readline.c | |
parent | c6bb6c0f8c90f5f14d933b974db4c3ce2c7b296f (diff) | |
download | cpython-e7a9796a0f83bd2e5e2b1d35ad8f0a2a96ec5e3f.zip cpython-e7a9796a0f83bd2e5e2b1d35ad8f0a2a96ec5e3f.tar.gz cpython-e7a9796a0f83bd2e5e2b1d35ad8f0a2a96ec5e3f.tar.bz2 |
Patch #800697: Add readline.clear_history.
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} }; |