summaryrefslogtreecommitdiffstats
path: root/Modules/_curses_panel.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/_curses_panel.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/_curses_panel.c')
-rw-r--r--Modules/_curses_panel.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c
index 18ef335..a98d2bf 100644
--- a/Modules/_curses_panel.c
+++ b/Modules/_curses_panel.c
@@ -59,8 +59,7 @@ static PyObject *
PyCursesCheckERR(int code, const char *fname)
{
if (code != ERR) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
} else {
if (fname == NULL) {
PyErr_SetString(_curses_panelstate_global->PyCursesError, catchall_ERR);
@@ -177,8 +176,8 @@ static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
#define Panel_NoArgTrueFalseFunction(X) \
static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self) \
{ \
- if (X (self->pan) == FALSE) { Py_INCREF(Py_False); return Py_False; } \
- else { Py_INCREF(Py_True); return Py_True; } }
+ if (X (self->pan) == FALSE) { Py_RETURN_FALSE; } \
+ else { Py_RETURN_TRUE; } }
#define Panel_TwoArgNoReturnFunction(X, TYPE, PARSESTR) \
static PyObject *PyCursesPanel_##X(PyCursesPanelObject *self, PyObject *args) \
@@ -245,8 +244,7 @@ PyCursesPanel_above(PyCursesPanelObject *self)
if (pan == NULL) { /* valid output, it means the calling panel
is on top of the stack */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
@@ -270,8 +268,7 @@ PyCursesPanel_below(PyCursesPanelObject *self)
if (pan == NULL) { /* valid output, it means the calling panel
is on the bottom of the stack */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
@@ -319,8 +316,7 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
}
Py_INCREF(temp);
Py_SETREF(po->wo, temp);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -406,8 +402,7 @@ PyCurses_bottom_panel(PyObject *self)
if (pan == NULL) { /* valid output, it means
there's no panel at all */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
@@ -452,8 +447,7 @@ PyCurses_top_panel(PyObject *self)
if (pan == NULL) { /* valid output, it means
there's no panel at all */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
po = find_po(pan);
if (po == NULL) {
@@ -469,8 +463,7 @@ static PyObject *PyCurses_update_panels(PyObject *self)
{
PyCursesInitialised;
update_panels();
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}