From 86568705df89fde7e9271329b0ba06c4a7ad7f1b Mon Sep 17 00:00:00 2001 From: Stuart Bishop Date: Sun, 18 Dec 2022 12:26:47 +1100 Subject: [PATCH] Let _all_timezones_unchecked be garbage collected when no longer needed --- src/pytz/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pytz/__init__.py b/src/pytz/__init__.py index 59a3bc9..91d7be1 100644 --- a/src/pytz/__init__.py +++ b/src/pytz/__init__.py @@ -202,7 +202,9 @@ def _case_insensitive_zone_lookup(zone): """case-insensitively matching timezone, else return zone unchanged""" global _all_timezones_lower_to_standard if _all_timezones_lower_to_standard is None: + global _all_timezones_unchecked _all_timezones_lower_to_standard = dict((tz.lower(), tz) for tz in _all_timezones_unchecked) # noqa + del _all_timezones_unchecked return _all_timezones_lower_to_standard.get(zone.lower()) or zone # noqa