mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Release GIL during entity replacement
This commit is contained in:
parent
55c2ad77ce
commit
6f00feb3cb
@ -157,7 +157,10 @@ replace_all_entities(PyObject *self, PyObject *const *args, Py_ssize_t nargs) {
|
|||||||
if (nargs > 1) keep_xml_entities = PyObject_IsTrue(args[1]);
|
if (nargs > 1) keep_xml_entities = PyObject_IsTrue(args[1]);
|
||||||
char *output = malloc(input_sz + 1);
|
char *output = malloc(input_sz + 1);
|
||||||
if (!output) { return PyErr_NoMemory(); }
|
if (!output) { return PyErr_NoMemory(); }
|
||||||
size_t output_sz = replace(input, input_sz, output, keep_xml_entities);
|
size_t output_sz;
|
||||||
|
Py_BEGIN_ALLOW_THREADS
|
||||||
|
output_sz = replace(input, input_sz, output, keep_xml_entities);
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
PyObject *retval;
|
PyObject *retval;
|
||||||
if (PyErr_Occurred()) retval = NULL;
|
if (PyErr_Occurred()) retval = NULL;
|
||||||
else if (!output_sz) retval = Py_NewRef(args[0]);
|
else if (!output_sz) retval = Py_NewRef(args[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user