aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-11-06 21:23:31 -0700
committerTom Tromey <tom@tromey.com>2017-01-10 19:13:32 -0700
commitf59fe7f8e3e55472e6fcfb06677ff4925dad1f64 (patch)
tree5823731e96f71cc8a665194b73616bb218619b48 /gdb
parent80bd970a4b1388fc4373b3e087006e6c93d71f60 (diff)
downloadgdb-f59fe7f8e3e55472e6fcfb06677ff4925dad1f64.zip
gdb-f59fe7f8e3e55472e6fcfb06677ff4925dad1f64.tar.gz
gdb-f59fe7f8e3e55472e6fcfb06677ff4925dad1f64.tar.bz2
Use gdbpy_ref in gdbpy_inferiors
This changes gdbpy_inferiors to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-inferior.c (gdbpy_inferiors): Use gdbpy_ref.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/python/py-inferior.c18
2 files changed, 9 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dc6ef9a..330718a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-01-10 Tom Tromey <tom@tromey.com>
+ * python/py-inferior.c (gdbpy_inferiors): Use gdbpy_ref.
+
+2017-01-10 Tom Tromey <tom@tromey.com>
+
* python/py-function.c (convert_values_to_python, fnpy_init): Use
gdbpy_ref.
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index f5462a4..995a3df 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -477,22 +477,14 @@ build_inferior_list (struct inferior *inf, void *arg)
PyObject *
gdbpy_inferiors (PyObject *unused, PyObject *unused2)
{
- PyObject *list, *tuple;
-
- list = PyList_New (0);
- if (!list)
+ gdbpy_ref list (PyList_New (0));
+ if (list == NULL)
return NULL;
- if (iterate_over_inferiors (build_inferior_list, list))
- {
- Py_DECREF (list);
- return NULL;
- }
-
- tuple = PyList_AsTuple (list);
- Py_DECREF (list);
+ if (iterate_over_inferiors (build_inferior_list, list.get ()))
+ return NULL;
- return tuple;
+ return PyList_AsTuple (list.get ());
}
/* Membuf and memory manipulation. */