[Python-Dev] GC and ExtensionClass

Neil Schemenauer nas@python.ca
Wed, 16 May 2001 09:19:42 -0700


Martin v. Loewis wrote:
> In any case, I think you need to analyse this in a debugger.

#7  0x080bc17e in tupletraverse (o=0x8154914, visit=0x807d640 <visit_decref>, 
    arg=0x0) at ../Objects/tupleobject.c:366
366                             err = visit(x, arg);
(gdb) p *o
$11 = {ob_refcnt = 1, ob_type = 0x80eb5a0, ob_size = 1, ob_item = {0x402c5180}}
(gdb) p *o->ob_item[0]
$12 = {ob_refcnt = 2, ob_type = 0x0}

In other words the GC is finding a tuple object that contains an
element with a funny looking address (data segment?) and an
op_type of NULL.  The collector has started running from here:

#10 0x0807debc in collect_generations () at ../Modules/gcmodule.c:467
#11 0x0807dfc4 in _PyGC_Insert (op=0x819f57c) at ../Modules/gcmodule.c:507
#12 0x080af56a in PyDict_New () at ../Objects/dictobject.c:149
#13 0x0808d8b8 in getBaseDictionary (type=0x402bcc40)
    at /home/skip/src/pygtk2-SNAP-20010408/ExtensionClass.c:1249
#14 0x0808eb45 in initializeBaseExtensionClass (self=0x402bcc40)
    at /home/skip/src/pygtk2-SNAP-20010408/ExtensionClass.c:1495
#15 0x08095fb1 in export_subclassed_type (dict=0x81851fc, 
    name=0x402a9388 "GdkDragContext", typ=0x402bcc40, bases=0x816fc34)
    at /home/skip/src/pygtk2-SNAP-20010408/ExtensionClass.c:3451
#16 0x400194ac in pygobject_register_class (dict=0x81851fc, 
    class_name=0x402a9388 "GdkDragContext", 
    get_type=0x404d5c50 <gdk_drag_context_get_type>, ec=0x402bcc40, 
    bases=0x816fc34) at gobjectmodule.c:202
#17 0x402a55fd in pygtk_register_classes (d=0x81851fc) at gtk.c:31844
#18 0x40257004 in init_gtk () at gtkmodule.c:98

I don't have time to dig deeper into this right now but perhaps
this will help someone.

  Neil