summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2001-10-03 15:46:24 +0000
committerMatt Wilson <msw@src.gnome.org>2001-10-03 15:46:24 +0000
commit5aabea13afc4aa1f18b862a19aeeea23be8b5a7b (patch)
tree1b0ad7d8c9e45ce6ff11e25c5db51691a5d50901
parentffa2720712e56103c2090cdecc812c97ce64b7f8 (diff)
downloadpygobject-5aabea13afc4aa1f18b862a19aeeea23be8b5a7b.tar.gz
pygobject-5aabea13afc4aa1f18b862a19aeeea23be8b5a7b.tar.xz
pygobject-5aabea13afc4aa1f18b862a19aeeea23be8b5a7b.zip
tweak the repr such that calling it on an uninitialized PyGObject won't
2001-10-03 Matt Wilson <msw@redhat.com> * gobjectmodule.c (pygobject_repr): tweak the repr such that calling it on an uninitialized PyGObject won't segfault. Also print the python class name.
-rw-r--r--gobject/gobjectmodule.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index f842397..3067b20 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -1131,10 +1131,13 @@ pygobject_hash(PyGObject *self)
static PyObject *
pygobject_repr(PyGObject *self)
{
- gchar buf[128];
+ gchar buf[256];
- g_snprintf(buf, sizeof(buf), "<%s at 0x%lx>", G_OBJECT_TYPE_NAME(self->obj),
- (long)self->obj);
+ g_snprintf(buf, sizeof(buf),
+ "<%s object (%s) at 0x%lx>",
+ self->ob_type->tp_name,
+ self->obj ? G_OBJECT_TYPE_NAME(self->obj) : "uninitialized",
+ (long)self);
return PyString_FromString(buf);
}