yuja added a comment.
Can you bump the cext version as this patch introduces new API? > +static int nt_init_py(nodetree *self, PyObject *args) > +{ > + PyObject *index; > + unsigned capacity; > + if (!PyArg_ParseTuple(args, "OI", &index, &capacity)) > + return -1; It leaves self->nodes uninitialized on error, and nt_dealloc() would fail if self->nodes wasn't luckily 0. Strictly speaking, it's too late to initialize pointers in tp_init because __init__() may be called more than once, but our C types don't handle such cases. > + return nt_init(self, (indexObject*)index, capacity); We'll probably need INCREF/DECREF business for the index object. I didn't review the other refcounting thingy carefully. Since it's painful to do refcounting right, an internal nodetree could be embedded in the indexObject, and a thin PyObject wrapper could be added. Just an idea. struct nodetree { }; struct nodetreeObject { PyObject_HEAD nodetree nt; }; struct indexObject { ... nodetree nt; ... }; REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4118 To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel