]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Work around _timezone name clash on windows
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 29 Jun 2021 03:19:25 +0000 (04:19 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 29 Jun 2021 12:47:15 +0000 (13:47 +0100)
https://bugs.python.org/issue24643

psycopg_c/psycopg_c/types/datetime.pyx

index 1aa3cb5d78808fe3fa3cd19c6b1dd2b8e02da6f8..80368db5bb018090bcae134a7123077c0a11bce3 100644 (file)
@@ -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,
-                <PyObject *>dt, <PyObject *>self._timezone, NULL)
+                <PyObject *>dt, <PyObject *>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,
-                <PyObject *>dt, <PyObject *>self._timezone, NULL)
+                <PyObject *>dt, <PyObject *>self._time_zone, NULL)
 
         except OverflowError:
             if val <= 0: