# HG changeset patch # User Boris Feld # Date 2018-02-05 14:03:51 # 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 --git a/mercurial/cext/mpatch.c b/mercurial/cext/mpatch.c --- a/mercurial/cext/mpatch.c +++ b/mercurial/cext/mpatch.c @@ -109,7 +109,13 @@ static PyObject *patches(PyObject *self, 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;