From: Daniele Varrazzo Date: Sun, 11 Dec 2022 20:25:12 +0000 (+0000) Subject: perf(c): add fast-call Cython function to PQflush wrapper X-Git-Tag: 3.1.5~7^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fac6effd2178eb00758365cea78d8f34f07f972;p=thirdparty%2Fpsycopg.git perf(c): add fast-call Cython function to PQflush wrapper --- diff --git a/psycopg_c/psycopg_c/pq.pxd b/psycopg_c/psycopg_c/pq.pxd index cf30906ea..57825dd3e 100644 --- a/psycopg_c/psycopg_c/pq.pxd +++ b/psycopg_c/psycopg_c/pq.pxd @@ -27,6 +27,7 @@ cdef class PGconn: @staticmethod cdef PGconn _from_ptr(libpq.PGconn *ptr) + cpdef int flush(self) except -1 cpdef object notifies(self) diff --git a/psycopg_c/psycopg_c/pq/pgconn.pyx b/psycopg_c/psycopg_c/pq/pgconn.pyx index d73ae9089..4a60530a2 100644 --- a/psycopg_c/psycopg_c/pq/pgconn.pyx +++ b/psycopg_c/psycopg_c/pq/pgconn.pyx @@ -440,7 +440,7 @@ cdef class PGconn: if 0 > libpq.PQsetnonblocking(self._pgconn_ptr, arg): raise e.OperationalError(f"setting nonblocking failed: {error_message(self)}") - def flush(self) -> int: + cpdef int flush(self) except -1: if self._pgconn_ptr == NULL: raise e.OperationalError(f"flushing failed: the connection is closed") cdef int rv = libpq.PQflush(self._pgconn_ptr)