diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:02:14 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:02:14 +0000 |
commit | 43e43c94044154de6f1bb49ddcdb47fd63e82784 (patch) | |
tree | 64bddb4b9c5c74b5bd2845a1f477219f1b9075d1 /bindings | |
parent | 17505a1805a47e80695ea1573530cdc5c6180da9 (diff) | |
download | lasso-43e43c94044154de6f1bb49ddcdb47fd63e82784.tar.gz lasso-43e43c94044154de6f1bb49ddcdb47fd63e82784.tar.xz lasso-43e43c94044154de6f1bb49ddcdb47fd63e82784.zip |
[project @ fpeters@0d.be-20071006151758-pwrstredrf19b2nw]
added repr support for PyGObjectPtr, displaying GObject type name and reference
count
Original author: Frederic Peters <fpeters@0d.be>
Date: 2007-10-06 17:17:58.258000+02:00
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/lang_python_wrapper_top.c | 11 |
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*/ |