This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] minor refcounting fix in pretty-printer
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Fri, 14 Nov 2008 07:30:23 -0700
- Subject: [python] minor refcounting fix in pretty-printer
- Reply-to: Tom Tromey <tromey at redhat dot com>
Today I happened to notice that in one error case we might skip a
deref.
Tom
2008-11-14 Tom Tromey <tromey@redhat.com>
* python/python.c (print_children): Don't "continue" past inner
cleanup.
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 206b4aa..5ac8230 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -903,13 +903,14 @@ print_children (PyObject *printer, struct ui_file *stream, int format,
if (! item)
break;
- inner_cleanup = make_cleanup_py_decref (item);
if (! PyArg_ParseTuple (item, "sO", &name, &py_v))
{
gdbpy_print_stack ();
+ Py_DECREF (item);
continue;
}
+ inner_cleanup = make_cleanup_py_decref (item);
if (i == 0)
fputs_filtered (" = {", stream);