[Python-Dev] tp_finalize vs tp_del sematics

Valentine Sinitsyn valentine.sinitsyn at gmail.com
Wed Aug 19 09:53:47 CEST 2015

Hi everybody,

I'm trying to get sense of PEP-0442 [1]. Most of the looks clear, 
however I wasn't able to answer myself one simple question: why it 
wasn't possible to implement proposed CI disposal scheme on top of 
tp_del? Common sense suggests that tp_del and tp_finalize have different 
semantics. For instance, with tp_finalize there is a guarantee that the 
object will be in a safe state, as documented at [2]. However, tp_del is 
not documented, and I have only vague idea of its guarantees. Are there any?

Thanks for the clarification.

1. https://www.python.org/dev/peps/pep-0442/
2. https://docs.python.org/3/c-api/typeobj.html

Best regards,
Valentine Sinitsyn

More information about the Python-Dev mailing list