diff mercurial/cext/manifest.c @ 36619: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 113a30b87716
children d9e87566f879
line wrap: on
line diff
--- a/mercurial/cext/manifest.c	Sat Mar 03 05:58:41 2018 -0500
+++ b/mercurial/cext/manifest.c	Sat Mar 03 06:08:22 2018 -0500
@@ -718,7 +718,8 @@
 	Py_INCREF(self->pydata);
 	for (i = 0; i < self->numlines; i++) {
 		PyObject *arglist = NULL, *result = NULL;
-		arglist = Py_BuildValue("(s)", self->lines[i].start);
+		arglist = Py_BuildValue(PY23("(s)", "(y)"),
+					self->lines[i].start);
 		if (!arglist) {
 			return NULL;
 		}