This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients corona10, pablogsal, serhiy.storchaka, shihai1991, tim.peters, vstinner
Date 2020-04-07.18:15:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586283328.97.0.26511764093.issue40217@roundup.psfhosted.org>
In-reply-to
Content
> Now we changed rules. A strong reference is created implicitly. Who is responsible to manage a strong reference? Whose who created it, ant it is the interpreter, not the user.

Even if we decide that the patch that introduced the new rules should not be reverted, then what we should do is wrap the tp_traverse of the user in something that also calls Py_VISIT(Py_TYPE(self)) so basically the tp_traverse of the type created by PyType_FromSpec will do

static int
PyType_FromSpec_tp_traverse(_abc_data *self, visitproc visit, void *arg)
{
    Py_VISIT(Py_TYPE(self))
    return self->user_provided_tp_traverse(self, visit, arg);
}

That way, we can still reason about what the tp_traverse should do, we don't break more rules and we don't need to make maintaining the GC even more difficult.
History
Date User Action Args
2020-04-07 18:15:29pablogsalsetrecipients: + pablogsal, tim.peters, vstinner, serhiy.storchaka, corona10, shihai1991
2020-04-07 18:15:28pablogsalsetmessageid: <1586283328.97.0.26511764093.issue40217@roundup.psfhosted.org>
2020-04-07 18:15:28pablogsallinkissue40217 messages
2020-04-07 18:15:28pablogsalcreate