changeset 31426: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 63a39d647888
children b2fb0fd239b8
files mercurial/parsers.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
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;
 }