Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever

possible.  Patch is writen with Coccinelle.
This commit is contained in:
Serhiy Storchaka 2017-01-23 09:47:21 +02:00
parent 60e6e962ba
commit 228b12edcc
57 changed files with 225 additions and 445 deletions

View file

@ -1218,8 +1218,7 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
{
if (addrlen == 0) {
/* No address -- may be recvfrom() from known socket */
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
switch (addr->sa_family) {
@ -2540,8 +2539,7 @@ static PyObject *
sock_gettimeout(PySocketSockObject *s)
{
if (s->sock_timeout < 0) {
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
else {
double seconds = _PyTime_AsSecondsDouble(s->sock_timeout);
@ -2701,8 +2699,7 @@ sock_bind(PySocketSockObject *s, PyObject *addro)
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
PyDoc_STRVAR(bind_doc,
@ -2738,8 +2735,7 @@ sock_close(PySocketSockObject *s)
return s->errorhandler();
}
}
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
PyDoc_STRVAR(close_doc,
@ -2996,8 +2992,7 @@ sock_listen(PySocketSockObject *s, PyObject *args)
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
PyDoc_STRVAR(listen_doc,
@ -4363,8 +4358,7 @@ sock_shutdown(PySocketSockObject *s, PyObject *arg)
Py_END_ALLOW_THREADS
if (res < 0)
return s->errorhandler();
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
PyDoc_STRVAR(shutdown_doc,
@ -6196,8 +6190,7 @@ static PyObject *
socket_getdefaulttimeout(PyObject *self)
{
if (defaulttimeout < 0) {
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
else {
double seconds = _PyTime_AsSecondsDouble(defaulttimeout);
@ -6222,8 +6215,7 @@ socket_setdefaulttimeout(PyObject *self, PyObject *arg)
defaulttimeout = timeout;
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}
PyDoc_STRVAR(setdefaulttimeout_doc,