Use gdbpy_ref in gdbpy_inferiors
authorTom Tromey <tom@tromey.com>
Mon, 7 Nov 2016 04:23:31 +0000 (21:23 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 11 Jan 2017 02:13:32 +0000 (19:13 -0700)
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.

gdb/ChangeLog
gdb/python/py-inferior.c

index dc6ef9ab03d4fd027262aae03a2c27e815350cb6..330718af4f82abff861642961f7da7973630aa3e 100644 (file)
@@ -1,3 +1,7 @@
+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
index f5462a4bbe2772d9840d5c0f024f1b891e09628b..995a3df26489d303eb0db2f3f4971ea47a9e3280 100644 (file)
@@ -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.  */
This page took 0.027579 seconds and 4 git commands to generate.