Hi Armin,

Thanks for replying.

On 23.08.2015 17:14, Armin Rigo wrote:
Hi Valentine,

On 19 August 2015 at 09:53, Valentine Sinitsyn
<valentine.sinit...@gmail.com> wrote:
why it wasn't possible to
implement proposed CI disposal scheme on top of tp_del?

I'm replying here as best as I understand the situation, which might
be incomplete or wrong.

 From the point of view of someone writing a C extension module, both
tp_del and tp_finalize are called with the same guarantee that the
object is still valid at that point.  The difference is only that the
presence of tp_del prevents the object from being collected at all if
it is part of a cycle.  Maybe the same could have been done without
duplicating the function pointer (tp_del + tp_finalize) with a
Py_TPFLAGS_DEL_EVEN_IN_A_CYCLE.
So you mean that this was to keep things backwards compatible for third-party extensions? I haven't thought about it this way, but this makes sense. However, the behavior of Python code using objects with __del__ has changed nevertheless: they are collectible now, and __del__ is always called exactly once, if I understand everything correctly.

Thanks,
Valentine

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to