Stop trying to store None in weakref cache
None is a singleton and a weak reference to it will never expire, and in
this case it is used more as a soft failure mode than as an actual value
to return. By special-casing this, the invariant that:
gettz(x) is gettz(x)
is preserved in all cases *except* when something on the underlying
system changes such that `x` does not refer to a valid time zone in the
first call, but does refer to a valid time zone in the second call. This
could happen if `x` is added to the zoneinfo data, or if the local time
zone changes such that `x` is now a valid specifier for the local time.
3 files changed