patches: release the GIL while applying the patch
This will allow multiple threads to apply patches at the same time.
--- a/mercurial/cext/mpatch.c Wed Feb 21 11:43:12 2018 +0100
+++ b/mercurial/cext/mpatch.c Mon Feb 05 15:03:51 2018 +0100
@@ -109,7 +109,13 @@
goto cleanup;
}
out = PyBytes_AsString(result);
- r = mpatch_apply(out, in, inlen, patch);
+ /* clang-format off */
+ {
+ Py_BEGIN_ALLOW_THREADS
+ r = mpatch_apply(out, in, inlen, patch);
+ Py_END_ALLOW_THREADS
+ }
+ /* clang-format on */
if (r < 0) {
Py_DECREF(result);
result = NULL;