Message 157658 - Python tracker (original) (raw)

Thanks for your comments Jim. They made me realize that the patch was incomplete. What is needed are two mutually exclusive flags that override the presence of the tp_del slot. This addresses your 1) point and is the case for Generators.

I don't think 2 is important. Does the context of the call matter? It is merely a question of whether a finalizer will or will not do something trivial.

Finalizers implemented in python can never run from garbage collection. the potential to do harm is simply too great. Which is why these extensions are purely the domain of specialized C extensions. Hence I don't think adding another slot, or allowing self-declared idempotent python finalizers to run during cleanup is a good idea.