From: Daniele Varrazzo Date: Wed, 14 Sep 2022 21:02:38 +0000 (+0100) Subject: fix(psycopg_c): propagate exceptions in Transformer.set_pgresult() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f20e4a359246a53b9e7205081d5824219587d73c;p=thirdparty%2Fpsycopg.git fix(psycopg_c): propagate exceptions in Transformer.set_pgresult() Fix #372 --- diff --git a/docs/news.rst b/docs/news.rst index 1ac7efbde..626cee107 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -7,6 +7,15 @@ ``psycopg`` release notes ========================= +Future releases +--------------- + +Psycopg 3.0.19 (unreleased) +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Fix segfault occurring when a loader fails initialization (:ticket:`#372`). + + Current release --------------- diff --git a/psycopg_c/psycopg_c/_psycopg/transform.pyx b/psycopg_c/psycopg_c/_psycopg/transform.pyx index ffd8bf99e..0c801cea5 100644 --- a/psycopg_c/psycopg_c/_psycopg/transform.pyx +++ b/psycopg_c/psycopg_c/_psycopg/transform.pyx @@ -108,7 +108,7 @@ cdef class Transformer: def pgresult(self) -> Optional[PGresult]: return self._pgresult - cpdef void set_pgresult( + cpdef set_pgresult( self, pq.PGresult result, object set_loaders = True, diff --git a/psycopg_c/psycopg_c/types/datetime.pyx b/psycopg_c/psycopg_c/types/datetime.pyx index b8b21fc32..33b0dd8b7 100644 --- a/psycopg_c/psycopg_c/types/datetime.pyx +++ b/psycopg_c/psycopg_c/types/datetime.pyx @@ -1124,8 +1124,6 @@ cdef object _timezone_from_connection(pq.PGconn pgconn): # Usually KeyError, but might be a DeprecationWarning raised by -Werror # (experienced on Python 3.6.12, backport.zoneinfo 0.2.1). # https://github.com/pganssle/zoneinfo/issues/109 - # Curiously, not trapping the latter, causes a segfault. - # In such case the error message is wrong, but hey. except Exception: logger.warning( "unknown PostgreSQL timezone: %r; will use UTC", sname