summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.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/_sre.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/_sre.c')
-rw-r--r--Modules/_sre.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 1cef7d0..061af39 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -481,8 +481,7 @@ state_getslice(SRE_STATE* state, Py_ssize_t index, PyObject* string, int empty)
/* want empty string */
i = j = 0;
else {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
} else {
i = STATE_OFFSET(state, state->mark[index]);
@@ -2368,8 +2367,7 @@ match_lastindex_get(MatchObject *self)
{
if (self->lastindex >= 0)
return PyLong_FromSsize_t(self->lastindex);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -2383,8 +2381,7 @@ match_lastgroup_get(MatchObject *self)
return result;
PyErr_Clear();
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -2466,8 +2463,7 @@ pattern_new_match(PatternObject* pattern, SRE_STATE* state, Py_ssize_t status)
} else if (status == 0) {
/* no match */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}