mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple Convert METH_OLDARGS -> METH_NOARGS: remove args parameter Please review. All tests pass, but some modules don't have tests. I spot checked various functions to try to make sure nothing broke.
This commit is contained in:
parent
50905b557b
commit
ba3a16c6c3
11 changed files with 85 additions and 164 deletions
|
|
@ -120,7 +120,7 @@ nis_match (PyObject *self, PyObject *args)
|
|||
PyObject *res;
|
||||
int fix;
|
||||
|
||||
if (!PyArg_Parse(args, "(t#s)", &key, &keylen, &map))
|
||||
if (!PyArg_ParseTuple(args, "t#s:match", &key, &keylen, &map))
|
||||
return NULL;
|
||||
if ((err = yp_get_default_domain(&domain)) != 0)
|
||||
return nis_error(err);
|
||||
|
|
@ -149,7 +149,7 @@ nis_cat (PyObject *self, PyObject *args)
|
|||
PyObject *dict;
|
||||
int err;
|
||||
|
||||
if (!PyArg_Parse(args, "s", &map))
|
||||
if (!PyArg_ParseTuple(args, "s:cat", &map))
|
||||
return NULL;
|
||||
if ((err = yp_get_default_domain(&domain)) != 0)
|
||||
return nis_error(err);
|
||||
|
|
@ -338,13 +338,11 @@ nis_maplist (void)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
nis_maps (PyObject *self, PyObject *args)
|
||||
nis_maps (PyObject *self)
|
||||
{
|
||||
nismaplist *maps;
|
||||
PyObject *list;
|
||||
|
||||
if (!PyArg_NoArgs(args))
|
||||
return NULL;
|
||||
if ((maps = nis_maplist ()) == NULL)
|
||||
return NULL;
|
||||
if ((list = PyList_New(0)) == NULL)
|
||||
|
|
@ -364,9 +362,9 @@ nis_maps (PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
static PyMethodDef nis_methods[] = {
|
||||
{"match", nis_match, METH_OLDARGS},
|
||||
{"cat", nis_cat, METH_OLDARGS},
|
||||
{"maps", nis_maps, METH_OLDARGS},
|
||||
{"match", nis_match, METH_VARARGS},
|
||||
{"cat", nis_cat, METH_VARARGS},
|
||||
{"maps", (PyCFunction)nis_maps, METH_NOARGS},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue