# HG changeset patch # User Bryan O'Sullivan # Date 2013-09-16 19:12:37 # Node ID b3c8c6f2b5c146c9d3464058ff40d031a97b371d # Parent 5e25d71a58cc93627f635bae699602dc7bb8afcf parsers: use Py_INCREF safely diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -540,11 +540,12 @@ static PyObject *index_get(indexObject * uncomp_len, base_rev, link_rev, parent_1, parent_2, c_node_id, 20); - if (entry) + if (entry) { PyObject_GC_UnTrack(entry); + Py_INCREF(entry); + } self->cache[pos] = entry; - Py_INCREF(entry); return entry; }