[IronPython] object lifecycle issues

William Reade william at resolversystems.com
Mon Jul 20 18:37:47 CEST 2009

Hi all

I have two problems that are at least somewhat related:

+++ Issue 1 (probably your bug):

C:\dev\ironclad - Copy>ipy y.py
real new
stub new
real init
real del

C:\dev\ironclad - Copy>python y.py
real new
stub new
stub init
real del

I freely admit that the attached code is pretty weird, but I really do 
need to do stuff like this in Ironclad. The difference in behaviour may 
or may not be responsible for certain failing numpy/scipy tests -- I'm 
not sure how to tell -- but I'd enormously appreciate a fix.

I'd report the issue on Codeplex, but trying to visit the issue tracker 
just leaves my browser spinning forever. Speaking of which: is there any 
alternative way of reporting bugs that doesn't make me feel as if I'm 
spamming the list with out-of-band noise? I'm pretty sure that a few 
bugs have just dropped off my stack in the last few months, just because 
I got tired of waiting for Codeplex to start working.

+++ Issue 2 (almost certainly my bug):

In a nearly identical* situation -- close enough that I can't say how 
it's actually different -- f will never get its __del__ method called 
(the object is destroyed -- a WeakReference to it knows it's dead -- but 
the __del__ call never happens).

For context: I have *very* similar classes, whose instances are 
constructed in exactly the weird way demonstrated in the attached file, 
and which work fine. The only difference between the cases that work and 
the cases that don't is that the broken cases multiply inherit from ipy 
types which wrap CLR types (int and float (and maybe str, although I 
haven't tested that one)), while the working cases have simple chains of 
single inheritance from user-defined types all the way up to object. 
However, the attached repro doesn't show my problem, so it's clearly not 
*just* to do with multiply inheriting from CLR types.

Does anyone have any idea what I might be doing wrong? I know this is a 
vague request, but I'm running out of ideas, and I'd really appreciate 
some input from someone who understands precisely what all those ipy 
MetaFoo classes are doing.


* the attached file started life as an attempt to repro the __del__ 
issue, and I incidentally noticed the __init__ issue.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: y.py
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090720/d5adb779/attachment.ksh>

More information about the Ironpython-users mailing list