# HG changeset patch # User Augie Fackler # Date 2015-08-26 14:20:07 # Node ID 50582df9d7a78ba7eb73eab46fb9e0e20d86e061 # Parent c568c4db036fa03db0422f0b63bfca1db0b1525f parsers: fix two cases of unsigned long instead of Py_ssize_t We had to do this before because Python 2.4 didn't understand the n format specifier in Py_BuildValue and friends. We no longer have that problem. diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -1046,13 +1046,12 @@ static PyObject *list_copy(PyObject *lis return newlist; } -/* arg should be Py_ssize_t but Python 2.4 do not support the n format */ -static int check_filter(PyObject *filter, unsigned long arg) { +static int check_filter(PyObject *filter, Py_ssize_t arg) { if (filter) { PyObject *arglist, *result; int isfiltered; - arglist = Py_BuildValue("(k)", arg); + arglist = Py_BuildValue("(n)", arg); if (!arglist) { return -1; } @@ -2665,12 +2664,10 @@ bail: static PyObject *fm1readmarkers(PyObject *self, PyObject *args) { const char *data; Py_ssize_t datalen; - /* only unsigned long because python 2.4, should be Py_ssize_t */ - unsigned long offset, stop; + Py_ssize_t offset, stop; PyObject *markers = NULL; - /* replace kk with nn when we drop Python 2.4 */ - if (!PyArg_ParseTuple(args, "s#kk", &data, &datalen, &offset, &stop)) { + if (!PyArg_ParseTuple(args, "s#nn", &data, &datalen, &offset, &stop)) { return NULL; } data += offset;