summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-01-13 04:22:54 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-01-13 04:22:54 (GMT)
commit547d4859b9cb7593fdd7e9828b18872cc4282ed6 (patch)
treeb84c51c129e02cb391576b330faadbac85c05d04 /Objects/rangeobject.c
parent00fa03900cd89d8af4ab4c6b8b0782a7d718142f (diff)
downloadcpython-547d4859b9cb7593fdd7e9828b18872cc4282ed6.zip
cpython-547d4859b9cb7593fdd7e9828b18872cc4282ed6.tar.gz
cpython-547d4859b9cb7593fdd7e9828b18872cc4282ed6.tar.bz2
plug reference leak
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index ee42ba9..979a62a 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -307,11 +307,13 @@ compute_range_item(rangeobject *r, PyObject *arg)
static PyObject *
range_item(rangeobject *r, Py_ssize_t i)
{
- PyObject *arg = PyLong_FromLong(i);
+ PyObject *res, *arg = PyLong_FromLong(i);
if (!arg) {
return NULL;
}
- return compute_range_item(r, arg);
+ res = compute_range_item(r, arg);
+ Py_DECREF(arg);
+ return res;
}
/* Additional helpers, since the standard slice helpers