summaryrefslogtreecommitdiff
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
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 274769d6b0..8d0f9e6df8 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,