[PATCH 3 of 6 v2] parsers: fix typing issue when constructing Python integer object

Henrik Stuart hg at hstuart.dk
Tue Sep 9 12:51:39 CDT 2014


# HG changeset patch
# User Henrik Stuart <hg at hstuart.dk>
# Date 1410199995 -7200
#      Mon Sep 08 20:13:15 2014 +0200
# Node ID 620d7f5d8ff74d46159e8fb83ebf3c9e401216b7
# Parent  f8504d79534d8753abccaa0f69f1100f8e2a3d4d
parsers: fix typing issue when constructing Python integer object

The passed variable is a Py_ssize_t, not a long, and consequently should use
PyInt_FromSsize_t rather than PyInt-FromLong. Fixed based on warning from
Microsoft Visual C++ 2008.

diff -r f8504d79534d -r 620d7f5d8ff7 mercurial/parsers.c
--- a/mercurial/parsers.c	Mon Sep 08 20:06:52 2014 +0200
+++ b/mercurial/parsers.c	Mon Sep 08 20:13:15 2014 +0200
@@ -881,7 +881,7 @@
 
 		if (nothead[i])
 			continue;
-		head = PyInt_FromLong(i);
+		head = PyInt_FromSsize_t(i);
 		if (head == NULL || PyList_Append(heads, head) == -1) {
 			Py_XDECREF(head);
 			goto bail;


More information about the Mercurial-devel mailing list