[pygtk] Custom C widget wrapped in PyGTK core dumps in debian.

Danie Roux droux@tuks.co.za
Wed, 27 Sep 2000 10:37:21 -0400


Hi all,

This is debian/gtk/python related.

I wrote a custom widget in gtk (C). Wrapped it with PyGTK and it worked
beautifully in RedHat. I've been using it a month now on RedHat.

I got Debian a few days back and have been struggling since. 

My custom, PyGTK wrapped widget core dumps when used from Python, but NOT
when used in a C program (without the Python binding).

The core dump reveals that it is python (??) that crashed. Here is the
relevant snippet of what happens:

static PyObject*
wrap_dir_listing_new (PyObject *self, PyObject *args)
{
    GtkObject *tmp;

    if (!PyArg_ParseTuple (args, ":gtk_dir_listing_new"))
        return NULL; /* If any arguments are sent, can't create object */

    /* To show that it is not my function that segfault */
    tmp = (GtkObject *) gtk_dir_listing_new ();
    /* tmp is not NULL */

    return PyGtk_New (tmp); // <--- This is where it segfaults
}

I thought it was because an older PyGTK is on Potato than on Redhat 6.2
but after installing the newer version it did not make a difference.

Another thing that bothered me. I had to put -lgtk -lglib and all that to
LDSHARED in the Makefile before it would run without complaining about
linker errors.

Could anybody please shed any light on this? 

Any other general tips on wrapping custom C widgets and packaging Python/C
programs would be more than welcome.

Danie.