# HG changeset patch # User Gregory Szorc # Date 1489452553 25200 # Node ID 43a7dfbead0cbad84ca828c25ec27f9b4eb0e9f2 # Parent 63a39d64788872a5742f8e3143b7ddd603e3af13 parsers: handle refcounting of "parents" consistently Py_None can be refcounted like any other Python object. So do that. diff -r 63a39d647888 -r 43a7dfbead0c mercurial/parsers.c --- a/mercurial/parsers.c Wed Mar 15 09:32:18 2017 -0700 +++ b/mercurial/parsers.c Mon Mar 13 17:49:13 2017 -0700 @@ -2739,6 +2739,7 @@ data += nparents * hashwidth; } else { parents = Py_None; + Py_INCREF(parents); } if (data + 2 * nmetadata > dataend) { @@ -2781,8 +2782,7 @@ Py_XDECREF(prec); Py_XDECREF(succs); Py_XDECREF(metadata); - if (parents != Py_None) - Py_XDECREF(parents); + Py_XDECREF(parents); return ret; }