logo       

Extension types can't have __del__ methods after all: msg#00050

python.pyrex

Subject: Extension types can't have __del__ methods after all

Bryan Weingarten <bryan.weingarten@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx +--------------------------------------+


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise