[Pyrex] Extension types can't have __del__ methods after all

Greg Ewing greg at cosc.canterbury.ac.nz
Sat Apr 24 13:24:38 CEST 2004


Bryan Weingarten <bryan.weingarten at pobox.com> wrote:

> i've read the docs on special methods in the extensions type
> section, but i'm having trouble with this one.  the doc says that
> __del__ will get called before __dealloc__.  but i can't get it to
> be called on the same page in the table below, i noticed that
> __del__ is not included, so i wonder if __del__ is really a special
> method for types.

I've just got around to checking this out. It seems I made an
assumption early on that this would work, but never actually tried
it out. It turns out that it doesn't work. I think __del__
methods only apply to user-defined types.

So you'll just have to do whatever you were going to do in the
__del__ method in the __dealloc__ method instead.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list