[PATCH 2 of 2] mpatch: use Py_ssize_t for string length

Adrian Buehlmann adrian at cadifra.com
Sun May 20 05:37:35 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1337470111 -7200
# Node ID 08c6cd85ac91409697d734c06ef9862ffe25062b
# Parent  dbb2896f75cedcf151f27d5556d57144ca3504df
mpatch: use Py_ssize_t for string length

diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -20,6 +20,7 @@
  of the GNU General Public License, incorporated herein by reference.
 */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <stdlib.h>
 #include <string.h>
@@ -355,7 +356,7 @@
 patchedsize(PyObject *self, PyObject *args)
 {
 	long orig, start, end, len, outlen = 0, last = 0;
-	int patchlen;
+	Py_ssize_t patchlen;
 	char *bin, *binend, *data;
 
 	if (!PyArg_ParseTuple(args, "ls#", &orig, &bin, &patchlen))


More information about the Mercurial-devel mailing list