Patchwork D6197: cext: make parsers.c PY_SSIZE_T_CLEAN

login
register
mail settings
Submitter phabricator
Date April 5, 2019, 11:57 a.m.
Message ID <af33d8125c362afe896a0f32746d7821@localhost.localdomain>
Download mbox | patch
Permalink /patch/39498/
State Not Applicable
Headers show

Comments

phabricator - April 5, 2019, 11:57 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG896b19d12c08: cext: make parsers.c PY_SSIZE_T_CLEAN (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6197?vs=14653&id=14670

REVISION DETAIL
  https://phab.mercurial-scm.org/D6197

AFFECTED FILES
  mercurial/cext/parsers.c

CHANGE DETAILS




To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -7,6 +7,7 @@ 
  the GNU General Public License, incorporated herein by reference.
 */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <ctype.h>
 #include <stddef.h>
@@ -164,8 +165,9 @@ 
 	PyObject *fname = NULL, *cname = NULL, *entry = NULL;
 	char state, *cur, *str, *cpos;
 	int mode, size, mtime;
-	unsigned int flen, len, pos = 40;
-	int readlen;
+	unsigned int flen, pos = 40;
+	Py_ssize_t len = 40;
+	Py_ssize_t readlen;
 
 	if (!PyArg_ParseTuple(
 	        args, PY23("O!O!s#:parse_dirstate", "O!O!y#:parse_dirstate"),
@@ -585,8 +587,7 @@ 
 static PyObject *fm1readmarkers(PyObject *self, PyObject *args)
 {
 	const char *data, *dataend;
-	int datalen;
-	Py_ssize_t offset, stop;
+	Py_ssize_t datalen, offset, stop;
 	PyObject *markers = NULL;
 
 	if (!PyArg_ParseTuple(args, PY23("s#nn", "y#nn"), &data, &datalen,