Stefan Behnel wrote:
> From the top of my 
> head, I don't even know which Python operations are really dangerous in 
> __dealloc__, and even those that are may not lead to an error in a 
> particular case due to the way GC works.

The only thing I can think of offhand that might
be a problem in the face of GC in particular is
that when __dealloc__ gets called, some of the
object's Python-valued attributes may have been
set to None as a result of cycle-breaking. If
you were to assume they were pointing to some
particular type of object, a crash could result.

More generally, the main thing to be careful of
in __dealloc__ is that Python-valued attributes
defined by a subclass may no longer contain valid
references (not even to None) by the time the
base class's __dealloc__ gets called. So if it
does anything that directly or indirectly results
in a method of the subclass getting called, and
that method tries to use one of the subclass's
attributes, a crash could result. But this has
nothing to do with GC particularly.

-- 
Greg
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to