[PATCH 2 of 3] osutil: make statfiles check for interrupts periodically

Bryan O'Sullivan bos at serpentine.com
Tue Nov 17 15:48:18 CST 2015


# HG changeset patch
# User Bryan O'Sullivan <bos at serpentine.com>
# Date 1447796834 28800
#      Tue Nov 17 13:47:14 2015 -0800
# Node ID f08030866c74e0585d5181344ee508fa63b8753c
# Parent  2476cd3ef3f7314553f6d88ce3a4bcbe730780bb
osutil: make statfiles check for interrupts periodically

This is a simpler and faster fix for issue4878 than the contortions
performed in 502b56a9e897.

diff --git a/mercurial/osutil.c b/mercurial/osutil.c
--- a/mercurial/osutil.c
+++ b/mercurial/osutil.c
@@ -613,6 +613,11 @@ static PyObject *statfiles(PyObject *sel
 		int ret, kind;
 		char *path;
 
+		/* With a large file count or on a slow filesystem,
+		   don't block signals for long (issue4878). */
+		if ((i % 1000) == 999 && PyErr_CheckSignals() == -1)
+			goto bail;
+
 		pypath = PySequence_GetItem(names, i);
 		if (!pypath)
 			goto bail;


More information about the Mercurial-devel mailing list