diff Modules/socketmodule.c @ 38489:3fe3ccdf0155 legacy-trunk

Make use of METH_O and METH_NOARGS where possible. Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
author Georg Brandl <georg@python.org>
date Mon, 29 May 2006 21:04:52 +0000
parents d3383063491f
children 8dfba087dc07
line wrap: on
line diff
--- a/Modules/socketmodule.c	Mon May 29 20:57:01 2006 +0000
+++ b/Modules/socketmodule.c	Mon May 29 21:04:52 2006 +0000
@@ -2889,12 +2889,10 @@
 
 /*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 @@
 	{"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},