summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-04-12 17:21:03 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-04-12 17:21:03 (GMT)
commit45d0b5cc44ffb6227a2379a39b00d480f253edd5 (patch)
tree5521e346f36337118e3cc173da245821689efcf2
parent501f02cd0215dede0195ac035ece5b1d4f8d2746 (diff)
downloadcpython-45d0b5cc44ffb6227a2379a39b00d480f253edd5.zip
cpython-45d0b5cc44ffb6227a2379a39b00d480f253edd5.tar.gz
cpython-45d0b5cc44ffb6227a2379a39b00d480f253edd5.tar.bz2
Use Py_RETURN_NONE macro where applicable.
-rw-r--r--Objects/listobject.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 9c0afa9..7a2cdea 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -652,20 +652,16 @@ listinsert(PyListObject *self, PyObject *args)
PyObject *v;
if (!PyArg_ParseTuple(args, "iO:insert", &i, &v))
return NULL;
- if (ins1(self, i, v) == 0) {
- Py_INCREF(Py_None);
- return Py_None;
- }
+ if (ins1(self, i, v) == 0)
+ Py_RETURN_NONE;
return NULL;
}
static PyObject *
listappend(PyListObject *self, PyObject *v)
{
- if (app1(self, v) == 0) {
- Py_INCREF(Py_None);
- return Py_None;
- }
+ if (app1(self, v) == 0)
+ Py_RETURN_NONE;
return NULL;
}
@@ -2089,8 +2085,7 @@ listreverse(PyListObject *self)
{
if (self->ob_size > 1)
reverse_slice(self->ob_item, self->ob_item + self->ob_size);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
int
@@ -2190,10 +2185,9 @@ listremove(PyListObject *self, PyObject *v)
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
if (cmp > 0) {
if (list_ass_slice(self, i, i+1,
- (PyObject *)NULL) != 0)
- return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ (PyObject *)NULL) == 0)
+ Py_RETURN_NONE;
+ return NULL;
}
else if (cmp < 0)
return NULL;