Changeset: a1dddd44c611 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a1dddd44c611
Modified Files:
        sql/backends/monet5/UDF/pyapi/connection.c
Branch: Jul2017
Log Message:

Release the GIL during loopback queries.


diffs (25 lines):

diff --git a/sql/backends/monet5/UDF/pyapi/connection.c 
b/sql/backends/monet5/UDF/pyapi/connection.c
--- a/sql/backends/monet5/UDF/pyapi/connection.c
+++ b/sql/backends/monet5/UDF/pyapi/connection.c
@@ -33,12 +33,18 @@ static PyObject *_connection_execute(Py_
                char *res = NULL;
                char *query;
 #ifndef IS_PY3K
-               query = ((PyStringObject *)args)->ob_sval;
+               query = GDKstrdup(((PyStringObject *)args)->ob_sval);
 #else
-               query = PyUnicode_AsUTF8(args);
+               query = GDKstrdup(PyUnicode_AsUTF8(args));
 #endif
-
+               if (!query) {
+                       PyErr_Format(PyExc_Exception, MAL_MALLOC_FAIL);
+                       return NULL;
+               }
+Py_BEGIN_ALLOW_THREADS;
                res = _connection_query(self->cntxt, query, &output);
+Py_END_ALLOW_THREADS;
+               GDKfree(query);
                if (res != MAL_SUCCEED) {
                        PyErr_Format(PyExc_Exception, "SQL Query Failed: %s",
                                                 (res ? res : "<no error>"));
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to