aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2018-09-10 12:05:22 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2018-10-25 12:20:18 +0100
commitb352ceb6b4fc9f026944d307704076d1e6894de9 (patch)
tree4898f1ba39b611a7fb9b609ef042c03e44848759 /gdb/python
parent50db9ef4c014d28dd64b2d660b043a40224a1a27 (diff)
downloadgdb-b352ceb6b4fc9f026944d307704076d1e6894de9.zip
gdb-b352ceb6b4fc9f026944d307704076d1e6894de9.tar.gz
gdb-b352ceb6b4fc9f026944d307704076d1e6894de9.tar.bz2
gdb/python: Make convert_values_to_python return gdbpy_ref<>
Make convert_values_to_python return a gdbpy_ref<> directly rather than building a gdbpy_ref<>, releasing it, and then having a new gdbpy_ref<> created to hold the result. I also added a header comment to convert_values_to_python. gdb/ChangeLog: * python/py-function.c (convert_values_to_python): Return gdbpy_ref<>. Add header comment. (fnpy_call): Adjust.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-function.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c
index 1900f0f..cf5e68a 100644
--- a/gdb/python/py-function.c
+++ b/gdb/python/py-function.c
@@ -34,7 +34,10 @@ extern PyTypeObject fnpy_object_type
-static PyObject *
+/* Return a reference to a tuple ARGC elements long. Each element of the
+ tuple is a PyObject converted from the corresponding element of ARGV. */
+
+static gdbpy_ref<>
convert_values_to_python (int argc, struct value **argv)
{
int i;
@@ -50,7 +53,7 @@ convert_values_to_python (int argc, struct value **argv)
return NULL;
PyTuple_SetItem (result.get (), i, elt.release ());
}
- return result.release ();
+ return result;
}
/* Call a Python function object's invoke method. */
@@ -64,7 +67,7 @@ fnpy_call (struct gdbarch *gdbarch, const struct language_defn *language,
gdbpy_enter enter_py (gdbarch, language);
struct value *value;
gdbpy_ref<> result;
- gdbpy_ref<> args (convert_values_to_python (argc, argv));
+ gdbpy_ref<> args = convert_values_to_python (argc, argv);
/* convert_values_to_python can return NULL on error. If we
encounter this, do not call the function, but allow the Python ->