Taragolis commented on code in PR #34683: URL: https://github.com/apache/airflow/pull/34683#discussion_r1341315069
########## 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: My favorite subject 🤣 The difference less than 1 microsecond for try/except and in the other case we have an application which communicate with DB and time to time this communications on suboptimal level (a lot of idle in transactions). But to be honest examples in this SO question are bad, because imports might take more time, much more than couple microseconds. So I'm fine with `sys.version_info >= (3, 9)` because import `sys` costs nothing, it should be already imported somewhere before ########## 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: My favorite subject 🤣 The difference less than 1 microsecond for try/except and in the other case we have an application which communicate with DB and time to time this communications on suboptimal level (a lot of idle in transactions). But to be honest examples in this SO question are bad, because imports might take more time, much more than couple microseconds. So I'm fine with `sys.version_info >= (3, 9)` because import `sys` costs nothing, it should be already imported somewhere before -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org