summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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