The chance for this to fail failed is slim (an error in the logger? A
ctrl-c just there?) but a bit of paranoia has never hurt anyone.
pgconn.notice_handler(res)
except Exception as exc:
logger.exception("error in notice receiver: %s", exc)
-
- res._pgresult_ptr = None # avoid destroying the pgresult_ptr
+ finally:
+ res._pgresult_ptr = None # avoid destroying the pgresult_ptr
class PGconn:
pgconn.notice_handler(res)
except Exception as e:
logger.exception("error in notice receiver: %s", e)
-
- res._pgresult_ptr = NULL # avoid destroying the pgresult_ptr
+ finally:
+ res._pgresult_ptr = NULL # avoid destroying the pgresult_ptr
cdef (Py_ssize_t, libpq.Oid *, char * const*, int *, int *) _query_params_args(