Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cext/revlog.c @ 36648:1f8c3fadbb8e
py3: bulk-replace bytes format specifier passed to Py_BuildValue()
On Python 3, "s" means a utf-8 string. We have to use "y" for bytes, sigh.
https://docs.python.org/3/c-api/arg.html#c.Py_BuildValue
Substituted using the following pattern with some manual fixes:
'\b(Py_BuildValue)\((\s*)"([^"]+)"'
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Mar 2018 06:08:22 -0500 |
parents | d13526333835 |
children | 186c6df3a373 |
line wrap: on
line diff
--- a/mercurial/cext/revlog.c Sat Mar 03 05:58:41 2018 -0500 +++ b/mercurial/cext/revlog.c Sat Mar 03 06:08:22 2018 -0500 @@ -87,9 +87,9 @@ static Py_ssize_t inline_scan(indexObject *self, const char **offsets); #if LONG_MAX == 0x7fffffffL -static char *tuple_format = "Kiiiiiis#"; +static char *tuple_format = PY23("Kiiiiiis#", "Kiiiiiiy#"); #else -static char *tuple_format = "kiiiiiis#"; +static char *tuple_format = PY23("kiiiiiis#", "kiiiiiiy#"); #endif /* A RevlogNG v1 index entry is 64 bytes long. */ @@ -2077,7 +2077,7 @@ Py_INCREF(&indexType); PyModule_AddObject(mod, "index", (PyObject *)&indexType); - nullentry = Py_BuildValue("iiiiiiis#", 0, 0, 0, + nullentry = Py_BuildValue(PY23("iiiiiiis#", "iiiiiiiy#"), 0, 0, 0, -1, -1, -1, -1, nullid, 20); if (nullentry) PyObject_GC_UnTrack(nullentry);