Make use of METH_O and METH_NOARGS where possible.

Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
This commit is contained in:
Georg Brandl 2006-05-29 21:04:52 +00:00
parent fd9a4b19e9
commit 96a8c3954c
26 changed files with 187 additions and 405 deletions

View file

@ -2889,12 +2889,10 @@ static PyTypeObject sock_type = {
/*ARGSUSED*/
static PyObject *
socket_gethostname(PyObject *self, PyObject *args)
socket_gethostname(PyObject *self, PyObject *unused)
{
char buf[1024];
int res;
if (!PyArg_ParseTuple(args, ":gethostname"))
return NULL;
Py_BEGIN_ALLOW_THREADS
res = gethostname(buf, (int) sizeof buf - 1);
Py_END_ALLOW_THREADS
@ -3986,13 +3984,13 @@ static PyMethodDef socket_methods[] = {
{"gethostbyaddr", socket_gethostbyaddr,
METH_VARARGS, gethostbyaddr_doc},
{"gethostname", socket_gethostname,
METH_VARARGS, gethostname_doc},
METH_NOARGS, gethostname_doc},
{"getservbyname", socket_getservbyname,
METH_VARARGS, getservbyname_doc},
{"getservbyport", socket_getservbyport,
METH_VARARGS, getservbyport_doc},
{"getprotobyname", socket_getprotobyname,
METH_VARARGS,getprotobyname_doc},
METH_VARARGS, getprotobyname_doc},
#ifndef NO_DUP
{"fromfd", socket_fromfd,
METH_VARARGS, fromfd_doc},