gdb_assert_not_reached ("invalid inferior_call_kind");
}
- gdbpy_ref<> ptid_obj (gdbpy_create_ptid_object (ptid));
+ gdbpy_ref<> ptid_obj = gdbpy_create_ptid_object (ptid);
if (ptid_obj == NULL)
return NULL;
THPY_REQUIRE_VALID (thread_obj);
- return gdbpy_create_ptid_object (thread_obj->thread->ptid);
+ return gdbpy_create_ptid_object (thread_obj->thread->ptid).release ();
}
/* Implement gdb.InferiorThread.ptid_string attribute. */
target_pid_to_str (thr->ptid).c_str ());
}
-/* Return a reference to a new Python object representing a ptid_t.
- The object is a tuple containing (pid, lwp, tid). */
-PyObject *
+/* See python-internal.h. */
+
+gdbpy_ref<>
gdbpy_create_ptid_object (ptid_t ptid)
{
int pid = ptid.pid ();
PyTuple_SET_ITEM (ret.get (), 1, lwp_obj.release ());
PyTuple_SET_ITEM (ret.get (), 2, tid_obj.release ());
- return ret.release ();
+ return ret;
}
/* Implementation of gdb.selected_thread () -> gdb.InferiorThread.
const char *encoding,
struct type *type);
PyObject *gdbpy_inferiors (PyObject *unused, PyObject *unused2);
-PyObject *gdbpy_create_ptid_object (ptid_t ptid);
+
+/* Return a reference to a new Python Tuple object representing a ptid_t.
+ The object is a tuple containing (pid, lwp, tid). */
+
+extern gdbpy_ref<> gdbpy_create_ptid_object (ptid_t ptid);
+
PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args);
PyObject *gdbpy_selected_inferior (PyObject *self, PyObject *args);
PyObject *gdbpy_string_to_argv (PyObject *self, PyObject *args);