diff options
author | Georg Brandl <georg@python.org> | 2006-05-29 21:04:52 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-05-29 21:04:52 (GMT) |
commit | 96a8c3954cbdb186bc567a490dad8987508ce268 (patch) | |
tree | 4d6516790abcd566c43418e4c9b02e9c52cf9f2f /Modules/dbmmodule.c | |
parent | fd9a4b19e9c77e9ccc3e7fcb57051cf160c0df6d (diff) | |
download | cpython-96a8c3954cbdb186bc567a490dad8987508ce268.zip cpython-96a8c3954cbdb186bc567a490dad8987508ce268.tar.gz cpython-96a8c3954cbdb186bc567a490dad8987508ce268.tar.bz2 |
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
Diffstat (limited to 'Modules/dbmmodule.c')
-rw-r--r-- | Modules/dbmmodule.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c index 8bfbbcd..9086c84 100644 --- a/Modules/dbmmodule.c +++ b/Modules/dbmmodule.c @@ -168,10 +168,8 @@ static PyMappingMethods dbm_as_mapping = { }; static PyObject * -dbm__close(register dbmobject *dp, PyObject *args) +dbm__close(register dbmobject *dp, PyObject *unused) { - if (!PyArg_ParseTuple(args, ":close")) - return NULL; if (dp->di_dbm) dbm_close(dp->di_dbm); dp->di_dbm = NULL; @@ -180,14 +178,12 @@ dbm__close(register dbmobject *dp, PyObject *args) } static PyObject * -dbm_keys(register dbmobject *dp, PyObject *args) +dbm_keys(register dbmobject *dp, PyObject *unused) { register PyObject *v, *item; datum key; int err; - if (!PyArg_ParseTuple(args, ":keys")) - return NULL; check_dbmobject_open(dp); v = PyList_New(0); if (v == NULL) @@ -277,9 +273,9 @@ dbm_setdefault(register dbmobject *dp, PyObject *args) } static PyMethodDef dbm_methods[] = { - {"close", (PyCFunction)dbm__close, METH_VARARGS, + {"close", (PyCFunction)dbm__close, METH_NOARGS, "close()\nClose the database."}, - {"keys", (PyCFunction)dbm_keys, METH_VARARGS, + {"keys", (PyCFunction)dbm_keys, METH_NOARGS, "keys() -> list\nReturn a list of all keys in the database."}, {"has_key", (PyCFunction)dbm_has_key, METH_VARARGS, "has_key(key} -> boolean\nReturn true iff key is in the database."}, |