Mercurial > public > mercurial-scm > hg-stable
diff mercurial/parsers.c @ 31435:43a7dfbead0c
parsers: handle refcounting of "parents" consistently
Py_None can be refcounted like any other Python object. So
do that.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 13 Mar 2017 17:49:13 -0700 |
parents | b6ab0adf379d |
children | a43fd9ec2a39 |
line wrap: on
line diff
--- 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; }