]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix(psycopg_c): guard PQflush calls for invalid connections
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 15 Aug 2022 00:46:19 +0000 (02:46 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 15 Aug 2022 13:37:26 +0000 (15:37 +0200)
commit1a4dcec18ca0fefd6d485991d4d4d0ae2a5d5156
treec153088ecf116a16666a9e458bf966e47a2d2b05
parent124ebba50515cb2a9d3672e35dffc6ff0677cd9f
fix(psycopg_c): guard PQflush calls for invalid connections

Unlike other libpq functions, PQflush() doesn't have a guard for invalid
connections and will segfault if the connection gets closed.

Also check the return value of the PQflush calls: as we are not using
the wrapped version pgconn.flush(), the function doesn't automatically
throw an exception on failure.
psycopg/psycopg/pq/pq_ctypes.py
psycopg_c/psycopg_c/_psycopg/generators.pyx