D4118: index: make node tree a Python object

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Wed Aug 22 08:12:42 EDT 2018


yuja added a comment.


  >   static int nt_init(nodetree *self, indexObject *index, unsigned capacity)
  >   {
  > 
  > +	/* Initialize before argument-checking to avoid nt_dealloc() crash. */
  >  +	self->nodes = NULL;
  >  +
  > 
  >   	self->index = index;
  > 
  > +	Py_INCREF(index);
  
  While thinking about a pure nodetree, I noticed this makes a similar situation
  to reference cycle between two C objects, index and index->nt. The index can't
  be freed until index->nt gets deleted.
  
  Perhaps the easiest way around is to convert an internal nodetree back to
  a plain C struct.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4118

To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list