From 6206c0fbf878ba5d9279ca377d21922ec92c251c Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 26 Mar 2022 01:18:05 +0100 Subject: [PATCH] perf: release the GIL in copy-related libpq functions Tests have shown that these functions may do a considerable amount of work, although purely CPU. --- psycopg_c/psycopg_c/pq/libpq.pxd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/psycopg_c/psycopg_c/pq/libpq.pxd b/psycopg_c/psycopg_c/pq/libpq.pxd index b554ff365..2f69e2fd1 100644 --- a/psycopg_c/psycopg_c/pq/libpq.pxd +++ b/psycopg_c/psycopg_c/pq/libpq.pxd @@ -253,9 +253,9 @@ cdef extern from "libpq-fe.h": PGnotify *PQnotifies(PGconn *conn) nogil # 33.9. Functions Associated with the COPY Command - int PQputCopyData(PGconn *conn, const char *buffer, int nbytes) - int PQputCopyEnd(PGconn *conn, const char *errormsg) - int PQgetCopyData(PGconn *conn, char **buffer, int async) + int PQputCopyData(PGconn *conn, const char *buffer, int nbytes) nogil + int PQputCopyEnd(PGconn *conn, const char *errormsg) nogil + int PQgetCopyData(PGconn *conn, char **buffer, int async) nogil # 33.10. Control Functions void PQtrace(PGconn *conn, FILE *stream); -- 2.47.2