[issue9141] Allow objects to decide if they can be collected by GC
Antoine Pitrou
report at bugs.python.org
Sat Jul 10 00:58:53 CEST 2010
Antoine Pitrou <pitrou at free.fr> added the comment:
> 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.
But why don't you try using tp_dealloc as I suggested instead? It will allow you to run a finalizer in all cases, without anything ending up in gc.garbage. It's what we do in the new io lib.
Also, I'm still worried that the mechanism you're proposing is a bit quirky. I hope other developers can give opinions or even suggestions.
> But since these patches of mine seem to be met with rather limited
> enthusiasm, I wonder if I should be bothering.
Well, the GC is a rather delicate affair and moreover it doesn't have a dedicated maintainer. That doesn't mean your patches are not interesting, but I think everyone tries to be very careful with that area of the code.
----------
nosy: +amaury.forgeotdarc, loewis
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9141>
_______________________________________
More information about the Python-bugs-list
mailing list