summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-23 09:47:21 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-23 09:47:21 +0200
commitbfeec6d871e3db2e0ddfdef01387913bc19cadd4 (patch)
tree4dc6007c796426315d9667698a4e20ec93072625 /Python/sysmodule.c
parent9c3975f9fe0633faf8e4ea11ccd03d5b3109498e (diff)
downloadcpython-bfeec6d871e3db2e0ddfdef01387913bc19cadd4.tar.gz
Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible. Patch is writen with Coccinelle.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 9c4d9e6a1c..81520ea84f 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -179,8 +179,7 @@ sys_displayhook(PyObject *self, PyObject *o)
/* After printing, also assign to '_' */
/* Before, set '_' to None to avoid recursion */
if (o == Py_None) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
if (_PyObject_SetAttrId(builtins, &PyId__, Py_None) != 0)
return NULL;
@@ -211,8 +210,7 @@ sys_displayhook(PyObject *self, PyObject *o)
return NULL;
if (_PyObject_SetAttrId(builtins, &PyId__, o) != 0)
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(displayhook_doc,
@@ -228,8 +226,7 @@ sys_excepthook(PyObject* self, PyObject* args)
if (!PyArg_UnpackTuple(args, "excepthook", 3, 3, &exc, &value, &tb))
return NULL;
PyErr_Display(exc, value, tb);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(excepthook_doc,
@@ -461,8 +458,7 @@ sys_settrace(PyObject *self, PyObject *args)
PyEval_SetTrace(NULL, NULL);
else
PyEval_SetTrace(trace_trampoline, args);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(settrace_doc,
@@ -500,8 +496,7 @@ sys_setprofile(PyObject *self, PyObject *args)
PyEval_SetProfile(NULL, NULL);
else
PyEval_SetProfile(profile_trampoline, args);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setprofile_doc,
@@ -542,8 +537,7 @@ sys_setcheckinterval(PyObject *self, PyObject *args)
return NULL;
if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_check_interval))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setcheckinterval_doc,
@@ -581,8 +575,7 @@ sys_setswitchinterval(PyObject *self, PyObject *args)
return NULL;
}
_PyEval_SetSwitchInterval((unsigned long) (1e6 * d));
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setswitchinterval_doc,
@@ -644,8 +637,7 @@ sys_setrecursionlimit(PyObject *self, PyObject *args)
}
Py_SetRecursionLimit(new_limit);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -1032,8 +1024,7 @@ sys_setdlopenflags(PyObject *self, PyObject *args)
if (!tstate)
return NULL;
tstate->interp->dlopenflags = new_val;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
PyDoc_STRVAR(setdlopenflags_doc,
@@ -1074,8 +1065,7 @@ sys_mdebug(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "i:mdebug", &flag))
return NULL;
mallopt(M_DEBUG, flag);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif /* USE_MALLOPT */