# HG changeset patch # User Boris Feld # Date 1517839431 -3600 # Node ID a2d11d23bb254a0f3cba98aec6f1af087c60321d # Parent c25290b981902f01ee651b6f8107d22ac332ce1b patches: release the GIL while applying the patch This will allow multiple threads to apply patches at the same time. diff -r c25290b98190 -r a2d11d23bb25 mercurial/cext/mpatch.c --- 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;