reachableroots: fix transposition of set and list types in PyArg_ParseTuple
authorAugie Fackler <augie@google.com>
Tue, 11 Aug 2015 15:34:10 -0400
changeset 26009 bbb698697efc
parent 26008 59d57ea69ae6
child 26010 2c03e521a0c5
reachableroots: fix transposition of set and list types in PyArg_ParseTuple This is being masked by the function not properly returning NULL when it raises an exception, so the client code was just falling back to the native codepath when it got None back. A future change removes all reason for this C function to return None, which exposed this problem during development.
mercurial/parsers.c
--- a/mercurial/parsers.c	Tue Aug 11 14:50:39 2015 -0400
+++ b/mercurial/parsers.c	Tue Aug 11 15:34:10 2015 -0400
@@ -1112,8 +1112,10 @@
 	long minroot;
 	PyObject *includepatharg = NULL;
 	int includepath = 0;
+	/* heads is a list */
 	PyObject *heads = NULL;
 	Py_ssize_t numheads;
+	/* roots is a set */
 	PyObject *roots = NULL;
 	PyObject *reachable = NULL;
 
@@ -1134,8 +1136,8 @@
 	char *seen = NULL;
 
 	/* Get arguments */
-	if (!PyArg_ParseTuple(args, "lO!O!O!", &minroot, &PySet_Type, &heads,
-				&PyList_Type, &roots, &PyBool_Type, &includepatharg))
+	if (!PyArg_ParseTuple(args, "lO!O!O!", &minroot, &PyList_Type, &heads,
+				&PySet_Type, &roots, &PyBool_Type, &includepatharg))
 		goto bail;
 
 	if (includepatharg == Py_True)