changeset 27410:41127e875758

parsers: use PyTuple_Pack instead of manual list-filling Suggested by Yuya.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 17 Dec 2015 13:07:34 -0800
parents 32bea9daa877
children c84a07530040
files mercurial/parsers.c
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Thu Dec 17 15:23:36 2015 -0800
+++ b/mercurial/parsers.c	Thu Dec 17 13:07:34 2015 -0800
@@ -1351,15 +1351,7 @@
 			goto release;
 		PyList_SET_ITEM(phaseslist, i, phaseval);
 	}
-	ret = PyList_New(2);
-	if (ret == NULL)
-		goto release;
-
-	PyList_SET_ITEM(ret, 0, phaseslist);
-	PyList_SET_ITEM(ret, 1, phasessetlist);
-	/* We don't release phaseslist and phasessetlist as we return them to
-	 * python */
-	goto done;
+	ret = PyTuple_Pack(2, phaseslist, phasessetlist);
 
 release:
 	Py_XDECREF(phaseslist);