diff options
author | Matt Wilson <msw@redhat.com> | 2001-10-03 15:46:24 +0000 |
---|---|---|
committer | Matt Wilson <msw@src.gnome.org> | 2001-10-03 15:46:24 +0000 |
commit | 5aabea13afc4aa1f18b862a19aeeea23be8b5a7b (patch) | |
tree | 1b0ad7d8c9e45ce6ff11e25c5db51691a5d50901 | |
parent | ffa2720712e56103c2090cdecc812c97ce64b7f8 (diff) | |
download | pygobject-5aabea13afc4aa1f18b862a19aeeea23be8b5a7b.tar.gz |
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.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index f8423974..3067b205 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); } |