osutil: avoid accidentally destroying the True object in isgui (issue2937) stable
authorSteve Streeting <steve@stevestreeting.com>
Thu, 08 Sep 2011 11:34:59 +0100
branchstable
changeset 15094 258eee414ab7
parent 15091 106f89299da6
child 15095 ec222a29bdf0
osutil: avoid accidentally destroying the True object in isgui (issue2937) Needed to use 'Py_RETURN_TRUE' instead of 'return Py_True' to avoid reference count errors which would randomly crash the Python executable during merge. This only happened when you had something configured in merge-tools and the merge was large enough.
mercurial/osutil.c
--- a/mercurial/osutil.c	Wed Sep 14 13:51:50 2011 +0200
+++ b/mercurial/osutil.c	Thu Sep 08 11:34:59 2011 +0100
@@ -523,9 +523,9 @@
 
 	if (dict != NULL) {
 		CFRelease(dict);
-		return Py_True;
+		Py_RETURN_TRUE;
 	} else {
-		return Py_False;
+		Py_RETURN_FALSE;
 	}
 }
 #endif