diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-03-31 15:43:28 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-03-31 15:43:28 (GMT) |
commit | b82d34f91eb2f43000cf7a8249aa74cc6b13d060 (patch) | |
tree | 1c3886ca9e236deca2327553c6351e50f0b64e3b /Modules/bsddbmodule.c | |
parent | ba3a16c6c3d3da0903873e9464dbc540eaeda1f7 (diff) | |
download | cpython-b82d34f91eb2f43000cf7a8249aa74cc6b13d060.zip cpython-b82d34f91eb2f43000cf7a8249aa74cc6b13d060.tar.gz cpython-b82d34f91eb2f43000cf7a8249aa74cc6b13d060.tar.bz2 |
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
Please review for correctness.
Diffstat (limited to 'Modules/bsddbmodule.c')
-rw-r--r-- | Modules/bsddbmodule.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/Modules/bsddbmodule.c b/Modules/bsddbmodule.c index d767626..78f8576 100644 --- a/Modules/bsddbmodule.c +++ b/Modules/bsddbmodule.c @@ -470,18 +470,16 @@ bsddb_has_key(bsddbobject *dp, PyObject *args) recno_t recno; if (dp->di_type == DB_RECNO) { - if (!PyArg_Parse(args, "i", &recno)) { - PyErr_SetString(PyExc_TypeError, - "key type must be integer"); + if (!PyArg_ParseTuple(args, "i;key type must be integer", + &recno)) { return NULL; } krec.data = &recno; krec.size = sizeof(recno); } else { - if (!PyArg_Parse(args, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "key type must be string"); + if (!PyArg_ParseTuple(args, "s#;key type must be string", + &data, &size)) { return NULL; } krec.data = data; @@ -511,18 +509,16 @@ bsddb_set_location(bsddbobject *dp, PyObject *key) recno_t recno; if (dp->di_type == DB_RECNO) { - if (!PyArg_Parse(key, "i", &recno)) { - PyErr_SetString(PyExc_TypeError, - "key type must be integer"); + if (!PyArg_ParseTuple(key, "i;key type must be integer", + &recno)) { return NULL; } krec.data = &recno; krec.size = sizeof(recno); } else { - if (!PyArg_Parse(key, "s#", &data, &size)) { - PyErr_SetString(PyExc_TypeError, - "key type must be string"); + if (!PyArg_ParseTuple(key, "s#;key type must be string", + &data, &size)) { return NULL; } krec.data = data; @@ -644,8 +640,8 @@ bsddb_sync(bsddbobject *dp) static PyMethodDef bsddb_methods[] = { {"close", (PyCFunction)bsddb_close, METH_NOARGS}, {"keys", (PyCFunction)bsddb_keys, METH_NOARGS}, - {"has_key", (PyCFunction)bsddb_has_key, METH_OLDARGS}, - {"set_location", (PyCFunction)bsddb_set_location, METH_OLDARGS}, + {"has_key", (PyCFunction)bsddb_has_key, METH_VARARGS}, + {"set_location", (PyCFunction)bsddb_set_location, METH_VARARGS}, {"next", (PyCFunction)bsddb_next, METH_NOARGS}, {"previous", (PyCFunction)bsddb_previous, METH_NOARGS}, {"first", (PyCFunction)bsddb_first, METH_NOARGS}, |