pganssle / zoneinfo

Reference implementation for the proposed standard library module zoneinfo
Other
51 stars 20 forks source link

Handle check for PYTHONTZPATH failing #131

Closed pganssle closed 1 year ago

pganssle commented 1 year ago

It is possible but unlikely for the python_tzpath_context function to fail between the start of the try block and the point where os.environ.get succeeds, in which case old_env will be undefined. In this case, we want to take no action.

Practically speaking this will really only happen in an error condition anyway, so it doesn't really matter, but we should probably do it right anyway.

This will also fix the lint CLI, which has apparently just recently started noticing that there's a potential used-before-assignment error here.