Mercurial > hg-stable
diff mercurial/cext/parsers.c @ 36649:186c6df3a373
py3: bulk-replace 'const char*' format specifier passed to PyArg_ParseTuple*()
Perhaps we need this because 's' accepts a unicode string.
https://docs.python.org/3/c-api/arg.html#strings-and-buffers
Substituted using the following pattern with some manual fixes:
'\b(PyArg_ParseTuple)\((\s*\w+,\s*)"([^"]+)"'
'\b(PyArg_ParseTupleAndKeywords)\((\s*\w+,\s*\w+,\s*)"([^"]+)"'
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Mar 2018 06:18:47 -0500 |
parents | 1f8c3fadbb8e |
children | 0304f22497fa |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Sat Mar 03 06:08:22 2018 -0500 +++ b/mercurial/cext/parsers.c Sat Mar 03 06:18:47 2018 -0500 @@ -48,8 +48,9 @@ char *str, *start, *end; int len; - if (!PyArg_ParseTuple(args, "O!O!s#:parse_manifest", &PyDict_Type, - &mfdict, &PyDict_Type, &fdict, &str, &len)) + if (!PyArg_ParseTuple( + args, PY23("O!O!s#:parse_manifest", "O!O!y#:parse_manifest"), + &PyDict_Type, &mfdict, &PyDict_Type, &fdict, &str, &len)) goto quit; start = str; @@ -241,8 +242,9 @@ unsigned int flen, len, pos = 40; int readlen; - if (!PyArg_ParseTuple(args, "O!O!s#:parse_dirstate", &PyDict_Type, - &dmap, &PyDict_Type, &cmap, &str, &readlen)) + if (!PyArg_ParseTuple( + args, PY23("O!O!s#:parse_dirstate", "O!O!y#:parse_dirstate"), + &PyDict_Type, &dmap, &PyDict_Type, &cmap, &str, &readlen)) goto quit; len = readlen; @@ -645,7 +647,8 @@ Py_ssize_t offset, stop; PyObject *markers = NULL; - if (!PyArg_ParseTuple(args, "s#nn", &data, &datalen, &offset, &stop)) { + if (!PyArg_ParseTuple(args, PY23("s#nn", "y#nn"), &data, &datalen, + &offset, &stop)) { return NULL; } dataend = data + datalen;