D4372: index: embed nodetree in index object to avoid reference cycle
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon Aug 27 13:12:48 EDT 2018
martinvonz added a comment.
In https://phab.mercurial-scm.org/D4372#67157, @yuja wrote:
> > -static int nt_init_py(nodetree *self, PyObject *args)
> > +static int ntobj_init(nodetreeObject *self, PyObject *args)
> >
> > {
> > PyObject *index;
> > unsigned capacity;
> >
> > + int ret;
> >
> > if (!PyArg_ParseTuple(args, "O!I", &indexType, &index, &capacity))
> > return -1;
> >
> > - return nt_init(self, (indexObject*)index, capacity); + ret = nt_init(&self->nt, (indexObject*)index, capacity); + if (ret == 0) { + Py_INCREF(index); + }
>
> Perhaps index should be increfed no matter if nt_init() succeeds or not,
> since the self is ntobj_dealloc()-ed anyway.
Good catch. Fixed.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4372
To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list