You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "bolkedebruin (via GitHub)" <gi...@apache.org> on 2023/09/29 12:01:54 UTC

[GitHub] [airflow] bolkedebruin commented on a diff in pull request #34683: Add support for ZoneInfo and generic UTC

bolkedebruin commented on code in PR #34683:
URL: https://github.com/apache/airflow/pull/34683#discussion_r1341282384


##########
airflow/serialization/serializers/timezone.py:
##########
@@ -69,4 +82,28 @@ def deserialize(classname: str, version: int, data: object) -> Timezone:
     if isinstance(data, int):
         return fixed_timezone(data)
 
+    if "zoneinfo.ZoneInfo" in classname:  # capturing backports and stdlib
+        if PY39:
+            from zoneinfo import ZoneInfo
+        else:
+            from backports.zoneinfo import ZoneInfo

Review Comment:
   In serialization we want to keep imports to a minimum, so not in the root indeed. I could check for the version explicitly like `sys.version_info >= (3, 9)`. The old fashioned stuff is slower (https://stackoverflow.com/questions/2522005/cost-of-exception-handlers-in-python) and in serialization the focus is on speed, particularly with datetimes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org