From 1cb87ef8ab861489e194bb1bf3b60b9bf1a0c554 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 29 Jun 2021 04:19:25 +0100 Subject: [PATCH] Work around _timezone name clash on windows https://bugs.python.org/issue24643 --- psycopg_c/psycopg_c/types/datetime.pyx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/psycopg_c/psycopg_c/types/datetime.pyx b/psycopg_c/psycopg_c/types/datetime.pyx index 1aa3cb5d7..80368db5b 100644 --- a/psycopg_c/psycopg_c/types/datetime.pyx +++ b/psycopg_c/psycopg_c/types/datetime.pyx @@ -731,11 +731,11 @@ cdef class TimestampBinaryLoader(CLoader): cdef class _BaseTimestamptzLoader(CLoader): - cdef object _timezone + cdef object _time_zone def __init__(self, oid: int, context: Optional[AdaptContext] = None): super().__init__(oid, context) - self._timezone = _timezone_from_connection(self._pgconn) + self._time_zone = _timezone_from_connection(self._pgconn) @cython.final @@ -810,7 +810,7 @@ cdef class TimestamptzLoader(_BaseTimestamptzLoader): y, m, d, vals[HO], vals[MI], vals[SE], us, timezone_utc) dt -= tzoff return PyObject_CallFunctionObjArgs(datetime_astimezone, - dt, self._timezone, NULL) + dt, self._time_zone, NULL) except ValueError as ex: s = bytes(data).decode("utf8", "replace") raise e.DataError(f"can't parse timestamptz {s!r}: {ex}") from None @@ -851,7 +851,7 @@ cdef class TimestamptzBinaryLoader(_BaseTimestamptzLoader): else: dt = pg_datetimetz_epoch - delta return PyObject_CallFunctionObjArgs(datetime_astimezone, - dt, self._timezone, NULL) + dt, self._time_zone, NULL) except OverflowError: if val <= 0: -- 2.47.3