[PATCH] merge: Fix segfault in Python when performing large merges on OS X (issue2937)

Dan Villiom Podlaski Christiansen dan at cabo.dk
Tue Sep 13 02:47:20 CDT 2011


# HG changeset patch
# User Steve Streeting <steve at stevestreeting.com>
# Date 1315478099 -3600
# Node ID c606be029624b0b370ce8ac809c423b812e640fd
# Parent  bfe903b1ff4eaa081ff4374b6d3744a0936b928e
merge: Fix segfault in Python when performing large merges on OS X (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.

diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -525,9 +525,9 @@ static PyObject *isgui(PyObject *self)
 
 	if (dict != NULL) {
 		CFRelease(dict);
-		return Py_True;
+		Py_RETURN_TRUE;
 	} else {
-		return Py_False;
+		Py_RETURN_FALSE;
 	}
 }
 #endif


More information about the Mercurial-devel mailing list