diff options
author | Michael W. Hudson <mwh@python.net> | 2003-01-30 14:17:16 (GMT) |
---|---|---|
committer | Michael W. Hudson <mwh@python.net> | 2003-01-30 14:17:16 (GMT) |
commit | 0e986a312fe926b6cdc54437eaf9e5837fda5ead (patch) | |
tree | b15d4b03f134662ab23843a18cf6aa5fddf82817 /Modules/readline.c | |
parent | 796df156cdfa162f47987c37bc102f5c70697e40 (diff) | |
download | cpython-0e986a312fe926b6cdc54437eaf9e5837fda5ead.zip cpython-0e986a312fe926b6cdc54437eaf9e5837fda5ead.tar.gz cpython-0e986a312fe926b6cdc54437eaf9e5837fda5ead.tar.bz2 |
I was in this module anyway, so I did some janitorial things.
METH_NOARGS functions are still called with two arguments, one NULL,
so put that back into the function definitions (I didn't know this
until recently).
Make get_history_length() METH_NOARGS.
Diffstat (limited to 'Modules/readline.c')
-rw-r--r-- | Modules/readline.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index b95d7cb..56115e9 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -150,11 +150,9 @@ history truncation."); /* Get history length */ static PyObject* -get_history_length(PyObject *self, PyObject *args) +get_history_length(PyObject *self, PyObject *noarg) { - if (!PyArg_ParseTuple(args, ":get_history_length")) - return NULL; - return Py_BuildValue("i", history_length); + return PyInt_FromLong(history_length); } PyDoc_STRVAR(get_history_length_doc, @@ -255,7 +253,7 @@ static PyObject *endidx = NULL; /* Get the beginning index for the scope of the tab-completion */ static PyObject * -get_begidx(PyObject *self) +get_begidx(PyObject *self, PyObject *noarg) { Py_INCREF(begidx); return begidx; @@ -269,7 +267,7 @@ get the beginning index of the readline tab-completion scope"); /* Get the ending index for the scope of the tab-completion */ static PyObject * -get_endidx(PyObject *self) +get_endidx(PyObject *self, PyObject *noarg) { Py_INCREF(endidx); return endidx; @@ -324,7 +322,7 @@ add a line to the history buffer"); /* Get the tab-completion word-delimiters that readline uses */ static PyObject * -get_completer_delims(PyObject *self) +get_completer_delims(PyObject *self, PyObject *noarg) { return PyString_FromString(rl_completer_word_break_characters); } @@ -392,7 +390,7 @@ return the current contents of history item at index."); /* Exported function to get current length of history */ static PyObject * -get_current_history_length(PyObject *self) +get_current_history_length(PyObject *self, PyObject *noarg) { HISTORY_STATE *hist_st; @@ -408,7 +406,7 @@ return the current (not the maximum) length of history."); /* Exported function to read the current line buffer */ static PyObject * -get_line_buffer(PyObject *self) +get_line_buffer(PyObject *self, PyObject *noarg) { return PyString_FromString(rl_line_buffer); } @@ -439,7 +437,7 @@ Insert text into the command line."); /* Redisplay the line buffer */ static PyObject * -redisplay(PyObject *self) +redisplay(PyObject *self, PyObject *noarg) { rl_redisplay(); Py_INCREF(Py_None); @@ -457,10 +455,9 @@ contents of the line buffer."); static struct PyMethodDef readline_methods[] = { {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind}, - {"get_line_buffer", (PyCFunction)get_line_buffer, - METH_NOARGS, doc_get_line_buffer}, + {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer}, {"insert_text", insert_text, METH_VARARGS, doc_insert_text}, - {"redisplay", (PyCFunction)redisplay, METH_NOARGS, doc_redisplay}, + {"redisplay", redisplay, METH_NOARGS, doc_redisplay}, {"read_init_file", read_init_file, METH_VARARGS, doc_read_init_file}, {"read_history_file", read_history_file, METH_VARARGS, doc_read_history_file}, @@ -473,16 +470,16 @@ static struct PyMethodDef readline_methods[] = {"set_history_length", set_history_length, METH_VARARGS, set_history_length_doc}, {"get_history_length", get_history_length, - METH_VARARGS, get_history_length_doc}, + METH_NOARGS, 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}, + {"get_begidx", get_begidx, METH_NOARGS, doc_get_begidx}, + {"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx}, {"set_completer_delims", set_completer_delims, METH_VARARGS, doc_set_completer_delims}, {"add_history", py_add_history, METH_VARARGS, doc_add_history}, - {"get_completer_delims", (PyCFunction)get_completer_delims, + {"get_completer_delims", get_completer_delims, METH_NOARGS, doc_get_completer_delims}, {"set_startup_hook", set_startup_hook, |