[Python-checkins] r87982 - python/branches/py3k/Objects/rangeobject.c

benjamin.peterson python-checkins at python.org
Thu Jan 13 05:22:54 CET 2011


Author: benjamin.peterson
Date: Thu Jan 13 05:22:54 2011
New Revision: 87982
Log:
plug reference leak
Modified:
 python/branches/py3k/Objects/rangeobject.c
Modified: python/branches/py3k/Objects/rangeobject.c
==============================================================================
--- python/branches/py3k/Objects/rangeobject.c	(original)
+++ python/branches/py3k/Objects/rangeobject.c	Thu Jan 13 05:22:54 2011
@@ -307,11 +307,13 @@
 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


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /