summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-23 07:47:21 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-23 07:47:21 (GMT)
commit228b12edcce49649d6befa3c03dbcefd5a22ae76 (patch)
tree1066be6909fb981fcf30e1a8e224d43567bd9b92 /Modules/socketmodule.c
parent60e6e962bac6a668d0df539ebf526a0a1c69eacd (diff)
downloadcpython-228b12edcce49649d6befa3c03dbcefd5a22ae76.zip
cpython-228b12edcce49649d6befa3c03dbcefd5a22ae76.tar.gz
cpython-228b12edcce49649d6befa3c03dbcefd5a22ae76.tar.bz2
Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible. Patch is writen with Coccinelle.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 274769d..8d0f9e6 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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,