]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
docs: mention Windows timezone problem fixed in change log
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 14 Sep 2022 11:59:14 +0000 (12:59 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 14 Sep 2022 11:59:14 +0000 (12:59 +0100)
docs/news.rst
psycopg/psycopg/_tz.py
psycopg_c/psycopg_c/types/datetime.pyx

index 810d9ba832564838d0c65b63e7403550887f695d..a77d7a6ca9416d424adb5302adb0a24da61c14b0 100644 (file)
@@ -7,6 +7,16 @@
 ``psycopg`` release notes
 =========================
 
+Future releases
+---------------
+
+Psycopg 3.1.2 (unreleased)
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- Fix handling of certain invalid time zones causing problems on Windows
+  (:ticket:`#371`).
+
+
 Current release
 ---------------
 
index 58c815686d47a93182c83f89c33601eff0b1a45d..813ed62617fd929a499e5fdc980855363caaa663 100644 (file)
@@ -31,6 +31,14 @@ def get_tzinfo(pgconn: Optional[PGconn]) -> tzinfo:
         except (KeyError, OSError):
             logger.warning("unknown PostgreSQL timezone: %r; will use UTC", sname)
             zi = timezone.utc
+        except Exception as ex:
+            logger.warning(
+                "error handling PostgreSQL timezone: %r; will use UTC (%s - %s)",
+                sname,
+                type(ex).__name__,
+                ex,
+            )
+            zi = timezone.utc
 
         _timezones[tzname] = zi
         return zi
index 5d32a66d318435f21ec600ff043483988151a250..9f1bc3caf5f0601628fc103fef9e8f39622acbfb 100644 (file)
@@ -1110,6 +1110,14 @@ cdef object _timezone_from_connection(pq.PGconn pgconn):
             "unknown PostgreSQL timezone: %r; will use UTC", sname
         )
         zi = timezone_utc
+    except Exception as ex:
+        logger.warning(
+            "error handling PostgreSQL timezone: %r; will use UTC (%s - %s)",
+            sname,
+            type(ex).__name__,
+            ex,
+        )
+        zi = timezone.utc
 
     _timezones[tzname] = zi
     return zi