summaryrefslogtreecommitdiffstats
path: root/bindings/lang_python_wrapper_top.c
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/lang_python_wrapper_top.c')
-rw-r--r--bindings/lang_python_wrapper_top.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/bindings/lang_python_wrapper_top.c b/bindings/lang_python_wrapper_top.c
index 255087c3..d1d3713a 100644
--- a/bindings/lang_python_wrapper_top.c
+++ b/bindings/lang_python_wrapper_top.c
@@ -39,6 +39,15 @@ PyGObjectPtr_New(GObject *obj)
return (PyObject*)self;
}
+static PyObject *
+PyGObjectPtr_repr(PyGObjectPtr *obj)
+{
+ return PyString_FromFormat("<PyGObjectPtr to %p (type: %s, refcount: %d)>",
+ obj->obj,
+ G_OBJECT_TYPE_NAME(obj->obj),
+ obj->obj->ref_count);
+}
+
static PyTypeObject PyGObjectPtrType = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
@@ -50,7 +59,7 @@ static PyTypeObject PyGObjectPtrType = {
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
- 0, /*tp_repr*/
+ (reprfunc)PyGObjectPtr_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/