diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-23 07:47:21 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-23 07:47:21 (GMT) |
commit | 228b12edcce49649d6befa3c03dbcefd5a22ae76 (patch) | |
tree | 1066be6909fb981fcf30e1a8e224d43567bd9b92 /Python/sysmodule.c | |
parent | 60e6e962bac6a668d0df539ebf526a0a1c69eacd (diff) | |
download | cpython-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 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 9c4d9e6..81520ea 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 */ |