Mercurial > hg-stable
comparison mercurial/parsers.c @ 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 | 7e8a883da171 |
children | 7c9eb2927879 |
comparison
equal
deleted
inserted
replaced
27409:32bea9daa877 | 27410:41127e875758 |
---|---|
1349 phaseval = PyInt_FromLong(phase); | 1349 phaseval = PyInt_FromLong(phase); |
1350 if (phaseval == NULL) | 1350 if (phaseval == NULL) |
1351 goto release; | 1351 goto release; |
1352 PyList_SET_ITEM(phaseslist, i, phaseval); | 1352 PyList_SET_ITEM(phaseslist, i, phaseval); |
1353 } | 1353 } |
1354 ret = PyList_New(2); | 1354 ret = PyTuple_Pack(2, phaseslist, phasessetlist); |
1355 if (ret == NULL) | |
1356 goto release; | |
1357 | |
1358 PyList_SET_ITEM(ret, 0, phaseslist); | |
1359 PyList_SET_ITEM(ret, 1, phasessetlist); | |
1360 /* We don't release phaseslist and phasessetlist as we return them to | |
1361 * python */ | |
1362 goto done; | |
1363 | 1355 |
1364 release: | 1356 release: |
1365 Py_XDECREF(phaseslist); | 1357 Py_XDECREF(phaseslist); |
1366 Py_XDECREF(phasessetlist); | 1358 Py_XDECREF(phasessetlist); |
1367 done: | 1359 done: |