[Pyrex] Tricky bug while unloading modules

Gustavo Sverzut Barbieri barbieri at gmail.com
Fri Nov 16 22:05:18 CET 2007


Hi,

I'm mailing both Cython and Pyrex as we use Cython, but 99% sure that
this problem also happens on Pyrex.

In Python-EFL we have two modules that are related: evas and
ecore.evas. The former is a canvas and its objects, the latter is the
window that contains the canvas and its objects.
    The window (ecore.evas) have a reference to the canvas (evas) that
have reference to it's children. The C module will do the cascade
delete when the root is deleted, with proper callbacks to inform
object death.

The problem happens when the window is not explicitly deleted by user
and the program ends: the module will be unloaded before the objects
are collected, but we have a call in the object dealloc that will use
a method (from another object), that requires a module python-string
to resolve the method. This string is NULL by that time, since
cleanup() was run on module unloading, making our software exit with
SEGV.

To avoid the problem, we're forcing object's death with "del window",
but it would be nice to have this object delete+unload done right,
maybe force collection of module objects before unloading or something
in these lines. I'm not sure what's the proper way to fix this.

-- 
Gustavo Sverzut Barbieri
--------------------------------------
Jabber: barbieri at gmail.com
   MSN: barbieri at gmail.com
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010



More information about the Pyrex mailing list