mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +03:00
Free the GIL in blocking operations in V2 COPY FROM.
This commit is contained in:
parent
aeec583ff1
commit
e8286084e9
|
@ -1065,13 +1065,18 @@ _pq_copy_in(cursorObject *curs)
|
|||
o = PyObject_CallFunction(func, NULL);
|
||||
if (o == NULL) goto clear;
|
||||
if (o == Py_None || PyString_GET_SIZE(o) == 0) break;
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
rv = PQputline(curs->conn->pgconn, PyString_AS_STRING(o));
|
||||
Py_END_ALLOW_THREADS;
|
||||
Py_DECREF(o);
|
||||
if (0 != rv) goto clear;
|
||||
}
|
||||
Py_XDECREF(o);
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
PQputline(curs->conn->pgconn, "\\.\n");
|
||||
PQendcopy(curs->conn->pgconn);
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
/* if for some reason we're using a protocol 3 libpq to connect to a
|
||||
protocol 2 backend we still need to cycle on the result set */
|
||||
|
|
Loading…
Reference in New Issue
Block a user