[issue9141] Allow objects to decide if they can be collected by GC

Antoine Pitrou report at bugs.python.org
Sun Jul 4 19:17:15 CEST 2010

Antoine Pitrou <pitrou at free.fr> added the comment:

> A finalizer _may_ be tp_del, but it may be any code that is called as
> part of tp_dealloc().  This patch allows an object to say:  Calling
> tp_dealloc() is currently unsafe from a gc.collect() run.

Well, I don't know what you mean. tp_dealloc should always be "safe" and
is never checked for by the GC.

By the way, tp_del isn't even documented, which reinforces my point that
it's not really for use by third-party extension types.

I think we are reaching the point where, if you want this to happen, you
should ask for opinions on python-dev, because I really don't understand
which problem you are trying to solve.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list