Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible. Patch is writen with Coccinelle.
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 @@
/* 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 @@
{
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 @@
return result;
PyErr_Clear();
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -2466,8 +2463,7 @@
} else if (status == 0) {
/* no match */
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}