summaryrefslogtreecommitdiffstats
path: root/Modules/readline.c
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2003-01-30 10:12:51 (GMT)
committerMichael W. Hudson <mwh@python.net>2003-01-30 10:12:51 (GMT)
commit796df156cdfa162f47987c37bc102f5c70697e40 (patch)
tree6d8b962e739189758b3741bc69bbc4e43293a9bd /Modules/readline.c
parent9b40e804c79cef8dd240b734589e7caffd8ee4bd (diff)
downloadcpython-796df156cdfa162f47987c37bc102f5c70697e40.zip
cpython-796df156cdfa162f47987c37bc102f5c70697e40.tar.gz
cpython-796df156cdfa162f47987c37bc102f5c70697e40.tar.bz2
Add the get_completer() function based on Michael Stone's patch in
[ 676342 ] after using pdb readline does not work correctly which is required to fix that bug. So maaybe a bugfix candidate.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r--Modules/readline.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 2ae996c..b95d7cb 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -350,6 +350,22 @@ for state in 0, 1, 2, ..., until it returns a non-string.\n\
It should return the next possible completion starting with 'text'.");
+static PyObject *
+get_completer(PyObject *self, PyObject *args)
+{
+ if (completer == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ Py_INCREF(completer);
+ return completer;
+}
+
+PyDoc_STRVAR(doc_get_completer,
+"get_completer() -> function\n\
+\n\
+Returns current completer function.");
+
/* Exported function to get any element of history */
static PyObject *
@@ -459,6 +475,7 @@ static struct PyMethodDef readline_methods[] =
{"get_history_length", get_history_length,
METH_VARARGS, get_history_length_doc},
{"set_completer", set_completer, METH_VARARGS, doc_set_completer},
+ {"get_completer", get_completer, METH_NOARGS, doc_get_completer},
{"get_begidx", (PyCFunction)get_begidx, METH_NOARGS, doc_get_begidx},
{"get_endidx", (PyCFunction)get_endidx, METH_NOARGS, doc_get_endidx},