+/* Implementation of gdb.Inferior.thread_from_handle (self, handle)
+ -> gdb.InferiorThread. */
+
+static PyObject *
+infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
+{
+ PyObject *handle_obj;
+ inferior_object *inf_obj = (inferior_object *) self;
+ static const char *keywords[] = { "handle", NULL };
+
+ INFPY_REQUIRE_VALID (inf_obj);
+
+ if (! gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &handle_obj))
+ return NULL;
+
+ const gdb_byte *bytes;
+ size_t bytes_len;
+ Py_buffer_up buffer_up;
+ Py_buffer py_buf;
+
+ if (PyObject_CheckBuffer (handle_obj)
+ && PyObject_GetBuffer (handle_obj, &py_buf, PyBUF_SIMPLE) == 0)
+ {
+ buffer_up.reset (&py_buf);
+ bytes = (const gdb_byte *) py_buf.buf;
+ bytes_len = py_buf.len;
+ }
+ else if (gdbpy_is_value_object (handle_obj))
+ {
+ struct value *val = value_object_to_value (handle_obj);
+ bytes = value_contents_all (val);
+ bytes_len = TYPE_LENGTH (value_type (val));
+ }
+ else
+ {
+ PyErr_SetString (PyExc_TypeError,
+ _("Argument 'handle' must be a thread handle object."));
+
+ return NULL;
+ }
+
+ try
+ {
+ struct thread_info *thread_info;
+
+ thread_info = find_thread_by_handle
+ (gdb::array_view<const gdb_byte> (bytes, bytes_len),
+ inf_obj->inferior);
+ if (thread_info != NULL)
+ return thread_to_thread_object (thread_info).release ();
+ }
+ catch (const gdb_exception &except)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+
+ Py_RETURN_NONE;
+}
+
+/* Implementation of gdb.Inferior.architecture. */
+
+static PyObject *
+infpy_architecture (PyObject *self, PyObject *args)
+{
+ inferior_object *inf = (inferior_object *) self;
+
+ INFPY_REQUIRE_VALID (inf);
+
+ return gdbarch_to_arch_object (inf->inferior->gdbarch);
+}
+
+/* Implement repr() for gdb.Inferior. */
+
+static PyObject *
+infpy_repr (PyObject *obj)
+{
+ inferior_object *self = (inferior_object *) obj;
+ inferior *inf = self->inferior;
+
+ if (inf == nullptr)
+ return PyString_FromString ("<gdb.Inferior (invalid)>");
+
+ return PyString_FromFormat ("<gdb.Inferior num=%d, pid=%d>",
+ inf->num, inf->pid);
+}
+
+