Patchwork [1,of,2] parsers: use PyTuple_SET_ITEM() to fill new marker tuples

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 9, 2015, 3:23 p.m.
Message ID <cb61444f1cb87643e72f.1441812226@mimosa>
Download mbox | patch
Permalink /patch/10436/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 9, 2015, 3:23 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1441438881 -32400
#      Sat Sep 05 16:41:21 2015 +0900
# Node ID cb61444f1cb87643e72f1323b03c03165d7352f8
# Parent  1d5f8bda8bb9d4d0e4e4b32eed6253e8b7907073
parsers: use PyTuple_SET_ITEM() to fill new marker tuples

Because we know these tuples have no member yet, PyTuple_SetItem() isn't
necessary.

Patch

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -2564,7 +2564,7 @@  static PyObject *readshas(
 			Py_DECREF(list);
 			return NULL;
 		}
-		PyTuple_SetItem(list, i, hash);
+		PyTuple_SET_ITEM(list, i, hash);
 		source += hashwidth;
 	}
 	return list;
@@ -2647,7 +2647,7 @@  static PyObject *fm1readmarker(const cha
 		if (!tmp) {
 			goto bail;
 		}
-		PyTuple_SetItem(metadata, i, tmp);
+		PyTuple_SET_ITEM(metadata, i, tmp);
 	}
 	ret = Py_BuildValue("(OOHO(di)O)", prec, succs, flags,
 			    metadata, mtime, (int)tz * 60, parents);