mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
This commit is contained in:
parent
fd9a4b19e9
commit
96a8c3954c
26 changed files with 187 additions and 405 deletions
|
@ -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},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue