Skip to content

Commit

Permalink
tweak the repr such that calling it on an uninitialized PyGObject won't
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mswilson authored and Matt Wilson committed Oct 3, 2001
1 parent ffa2720 commit 5aabea1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gobject/gobjectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 5aabea1

Please sign in to comment.