]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
perf(c): add fast-call Cython function to PQflush wrapper 426/head
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sun, 11 Dec 2022 20:25:12 +0000 (20:25 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 12 Dec 2022 02:29:18 +0000 (02:29 +0000)
psycopg_c/psycopg_c/pq.pxd
psycopg_c/psycopg_c/pq/pgconn.pyx

index cf30906ea1a4393854dea8329a8c5e6c7625aff4..57825dd3eb08c4da6a681ac0b2688f0beabe6701 100644 (file)
@@ -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)
 
 
index d73ae908935963c0ba7a266176803b7df7958fba..4a60530a277b9b1b655240454b80dafd8a191c62 100644 (file)
@@ -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)