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.
It is possible but unlikely for the
python_tzpath_context
function to fail between the start of thetry
block and the point whereos.environ.get
succeeds, in which caseold_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.