osutil: make statfiles check for interrupts periodically
authorBryan O'Sullivan <bos@serpentine.com>
Tue, 17 Nov 2015 13:47:14 -0800
changeset 26983 f9f2f29ce023
parent 26982 fa6685ea7ad8
child 26984 af2663680e95
osutil: make statfiles check for interrupts periodically This is a simpler and faster fix for issue4878 than the contortions performed in 502b56a9e897.
mercurial/osutil.c
--- a/mercurial/osutil.c	Tue Nov 17 13:43:09 2015 -0800
+++ b/mercurial/osutil.c	Tue Nov 17 13:47:14 2015 -0800
@@ -613,6 +613,11 @@
 		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;