[Python-Dev] GC and ExtensionClass

Guido van Rossum guido@digicool.com
Fri, 11 May 2001 16:49:00 -0500


> Has anyone investigated interactions between ExtensionClass objects and GC?
> I've encountered segfaults with 2.1 in certain situations when using the
> latest PyGtk stuff.  The gdb traceback (appended) sort of suggests the two
> intersect somewhere.  PyGtk provides a Python interface to the Gtk widget
> get using ExtensionClasses.  Any ideas how I should approach the problem?  I
> don't know either piece of code at all and the code that generates the
> segfault isn't particularly small, not to mention which it uses the bleeding
> edge Gtk stuff (which I doubt anyone on this list will have installed) and a
> version of ExtensionClass patched by James Henstridge, the PyGtk author.
> 
> Here's what I know:
> 
>     1. Disabling gc gets rid of the segfault
>     2. I only see the problem with importing a specific module that
>        subclasses the GtkTextView widget from the Python command line.  If I
>        run it as a script from the shell prompt, I get no segfault.
>     3. If I first import the gtk module, then import my module, I get no
>        segfault. 
>     4. Most changes I make to the module causing the problem cause the
>        problemm to disappear.
> 
> All told, all this really tells me is I'm probably dealing with a
> malloc/free problem of some sort.
> 
> Neil and/or Jim (and/or anyone else willing to look into this problem), I
> can give you access to my development machine via ssh if you think that
> would help debug the problem.

AFAIK, the latest version of Zope (which uses ExtensionClass
extensively if not exclusively :-) works fine with Python 2.1.

This suggests pointing a finger towards the PyGtk code... :-(

--Guido van Rossum (home page: http://www.python.org/~guido/)