diff mercurial/cext/bdiff.c @ 36620: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 29dd37a418aa
children b864f4536ca8
line wrap: on
line diff
--- a/mercurial/cext/bdiff.c	Sat Mar 03 06:08:22 2018 -0500
+++ b/mercurial/cext/bdiff.c	Sat Mar 03 06:18:47 2018 -0500
@@ -70,7 +70,8 @@
 
 	l.next = NULL;
 
-	if (!PyArg_ParseTuple(args, "s#s#:bdiff", &sa, &la, &sb, &lb))
+	if (!PyArg_ParseTuple(args, PY23("s#s#:bdiff", "y#y#:bdiff"), &sa, &la,
+	                      &sb, &lb))
 		return NULL;
 
 	if (la > UINT_MAX || lb > UINT_MAX) {
@@ -196,7 +197,7 @@
 	Py_ssize_t nelts = 0, size, i, start = 0;
 	PyObject *result = NULL;
 
-	if (!PyArg_ParseTuple(args, "s#", &text, &size)) {
+	if (!PyArg_ParseTuple(args, PY23("s#", "y#"), &text, &size)) {
 		goto abort;
 	}
 	if (!size) {