Re: gobject-introspection and GBoxed
- From: jcupitt gmail com
- To: Tomeu Vizoso <tomeu sugarlabs org>
- Cc: gtk-devel-list <gtk-devel-list gnome org>
- Subject: Re: gobject-introspection and GBoxed
- Date: Fri, 13 Jan 2012 12:04:16 +0000
Hi Tomeu,
On 12 January 2012 11:02, Tomeu Vizoso <tomeu sugarlabs org> wrote:
> Looks like a bug in pygobject, could you file a bug with a backtrace?
>
> It may be worth trying out with the latest release to scope better the problem.
I've tried with git master gobject-introspection and 3.0.3 pygobject
and the crash has gone but it still doesn't work. Should I file a bug
or am I making a stupid error?
I have this in the header:
----
/* A very simple boxed type for testing. Just holds an int.
*/
typedef struct _VipsThing {
int i;
} VipsThing;
/**
* VIPS_TYPE_THING:
*
* The #GType for a #VipsThing.
*/
#define VIPS_TYPE_THING (vips_thing_get_type())
GType vips_thing_get_type( void );
VipsThing *vips_thing_new( int i );
int vips_thing_get_i( VipsThing *thing );
-----
this in the .c file:
-----------
/* A very simple boxed type for testing. Just an int.
*/
/**
* vips_thing_new:
* @n:
*
* Returns: (transfer full): a new #VipsThing.
*/
VipsThing *
vips_thing_new( int i )
{
VipsThing *thing;
thing = g_new( VipsThing, 1 );
thing->i = i;
printf( "vips_thing_new: %d %p\n", i, thing );
return( thing );
}
static VipsThing *
vips_thing_copy( VipsThing *thing )
{
VipsThing *thing2;
thing2 = vips_thing_new( thing->i );
printf( "vips_thing_copy: %d %p = %p\n", thing->i, thing2, thing );
return( thing2 );
}
static void
vips_thing_free( VipsThing *thing )
{
printf( "vips_thing_free: %d %p\n", thing->i, thing );
g_free( thing );
}
int
vips_thing_get_i( VipsThing *thing )
{
printf( "vips_thing_get_i: %d %p\n", thing->i, thing );
return( thing->i );
}
G_DEFINE_BOXED_TYPE( VipsThing, vips_thing,
(GBoxedCopyFunc) vips_thing_copy,
(GBoxedFreeFunc) vips_thing_free );
-------------------
But this happens in Python:
>>> from gi.repository import Vips
>>> dir(Vips)
... long list, all the GObject based types I use are there and work,
so I think the introspection stuff is OK
... Vips.thing* is not there, but Vips.Thing is
>>> Vips.Thing
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/john/vips/lib/python2.7/site-packages/gi/module.py",
line 243, in __getattr__
return getattr(self._introspection_module, name)
NotImplementedError: <gi.BoxedInfo object (Thing) at 0x0x7f9e7ac674d0>
>>> Vips.Thing(12)
NotImplementedError: <gi.BoxedInfo object (Thing) at 0x0x7f9e7ac676c8>
>>> Vips.Thing.new(12)
NotImplementedError: <gi.BoxedInfo object (Thing) at 0x0x7f9e7ac675f0>
>>> dir(Vips.Thing)
NotImplementedError: <gi.BoxedInfo object (Thing) at 0x0x7f9e7ac67a70>
>>> Vips.thing_new
AttributeError: 'gi.repository.Vips' object has no attribute 'thing_new'
>>>
The "/home/john/vips/lib/python2.7/site-packages/gi/module.py" in the
backtrace proves that I'm using my own build of gi master and not the
host one, I hope.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]