On Wed, Dec 29, 2021 at 5:18 AM Marco Sulla
<marco.sulla.pyt...@gmail.com> wrote:
>
>
> > But PyObject_GC_Track() is a public API.
>
> The problem is I can't invoke PyObject_GC_Track() on an already
> tracked object. I tried it and Python segfaulted. That's why CPython
> uses _PyObject_GC_IS_TRACKED() before.
>

You are right. I thought PyObject_GC_Track() can be used to tracked
objects because PyObject_GC_Untrack() can be used untracked object.
I think there is no enough reason for this asymmetry.

Additionally, adding PyObject_GC_IsTracked() to public API will not
bother future Python improvements.
If Python changed its GC to mark-and-sweep, PyObject_GC_IsTracked()
can return true always.

Regards,

-- 
Inada Naoki  <songofaca...@gmail.com>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to