[Python-checkins] cpython (2.7): Fix refcount leak in the reference counting example section (!).
georg.brandl
python-checkins at python.org
Sun Apr 14 11:44:55 CEST 2013
http://hg.python.org/cpython/rev/588a00e4f1f6
changeset: 83348:588a00e4f1f6
branch: 2.7
parent: 83342:4cc94d30926f
user: Georg Brandl <georg at python.org>
date: Sun Apr 14 11:45:16 2013 +0200
summary:
Fix refcount leak in the reference counting example section (!).
files:
Doc/c-api/intro.rst | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -255,8 +255,10 @@
PyObject *index = PyInt_FromLong(i);
if (!index)
return -1;
- if (PyObject_SetItem(target, index, item) < 0)
+ if (PyObject_SetItem(target, index, item) < 0) {
+ Py_DECREF(index);
return -1;
+ }
Py_DECREF(index);
}
return 0;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list