Kristján Valur Jónsson <krist...@ccpgames.com> added the comment:

Hi Antoine.
I am not adding another traversal pass.  I am modifying the function that gets 
called for every object about to be collected, to call the object's traversal 
function.  This is hardly an extra "pass" and is done only for objects that are 
about to be collected (i.e. only in the rare case).

The particular case is this:  I have objects (tasklets) that depending on their 
runtime state, need to run a finalizer or not.  If not, they can be collected.  
If they do, then they end up on gc.garbage.

This is exactly the same case as with generators.  But instead of adding yet 
another special case into stackless python, I realized that it may be up to 
objects' runtime state whether they need to run a finalizer or not.  So, I 
wrote a more generic way and decided to contribute it to C Python, so that a 
future developer, having a C extension that only sometimes needs to run a 
finalizer, could have a way to cleanly deal with garbage collection.  This is 
twice now that this problem has been seen in python.  The first time, a special 
case was coded into gcmodule.  This second time, I'm offering a more generic 
solution.

Now, I have a number of useful improvements and additions to C python sitting 
in our repository, the result of over 7 years work with Python at CCP games.  I 
have another one sitting and waiting that adds useful functionality to 
gcmodule.  Useful in my opinion anyway, and worth at least being kept for 
posterity as a patch in the tracker.  But since these patches of mine seem to 
be met with rather limited enthusiasm,  I wonder if I should be bothering.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9141>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to