# HG changeset patch # User Bryan O'Sullivan # Date 2015-12-17 21:07:34 # Node ID 41127e875758315cb716ef922cee20060f9f5a03 # Parent 32bea9daa87733240a0671e44f4d5e9e5e110cb6 parsers: use PyTuple_Pack instead of manual list-filling Suggested by Yuya. diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -1351,15 +1351,7 @@ static PyObject *compute_phases_map_sets 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);