reachableroots: if allocating a new set fails, use PyErr_NoMemory()
authorAugie Fackler <augie@google.com>
Tue, 11 Aug 2015 14:49:40 -0400
changeset 26007 1ebf4ac07582
parent 26006 1ffd97cbf9a2
child 26008 59d57ea69ae6
reachableroots: if allocating a new set fails, use PyErr_NoMemory() My inspection of the implementation of PySet_New() indicates that it does *not* reliably set an exception in the cases where it returns NULL (as far as I can tell it'll never do that!), so let's set that up ourselves.
mercurial/parsers.c
--- a/mercurial/parsers.c	Thu Aug 06 22:11:20 2015 -0700
+++ b/mercurial/parsers.c	Tue Aug 11 14:49:40 2015 -0400
@@ -1143,8 +1143,10 @@
 
 	/* Initialize return set */
 	reachable = PySet_New(0);
-	if (reachable == NULL)
+	if (reachable == NULL) {
+		PyErr_NoMemory();
 		goto bail;
+	}
 
 	/* Initialize internal datastructures */
 	tovisit = (int *)malloc((len + 1) * sizeof(int));