summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-29 21:04:52 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-29 21:04:52 (GMT)
commit96a8c3954cbdb186bc567a490dad8987508ce268 (patch)
tree4d6516790abcd566c43418e4c9b02e9c52cf9f2f /Modules/socketmodule.c
parentfd9a4b19e9c77e9ccc3e7fcb57051cf160c0df6d (diff)
downloadcpython-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/socketmodule.c')
-rw-r--r--Modules/socketmodule.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 6f9f5f3..5f7a520 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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},