]> git.ipfire.org Git - thirdparty/babel.git/commit
Avoid crashing on importing `babel.localtime` when TZ envvar is malformed (#1100)
authorAarni Koskela <akx@iki.fi>
Tue, 23 Jul 2024 07:10:08 +0000 (10:10 +0300)
committerGitHub <noreply@github.com>
Tue, 23 Jul 2024 07:10:08 +0000 (10:10 +0300)
commitad0fabea327ee1666fd46ee801d8deb88a0be9a3
treefaaf6e349c95b8b9b22e6ae1b3fb0b0126479046
parent2f87363410f3c904e107e85ca10b9f84902db93f
Avoid crashing on importing `babel.localtime` when TZ envvar is malformed (#1100)

When `pytz` is _not_ installed, importing `babel.localtime` could fail
(repeatedly) when the `TZ` environment variable is malformed enough to be
caught by `_validate_tzfile_path`, which might throw a certain `ValueError`.

(When `pytz` is installed, it would raise an `UnknownTimeZoneError` we
already catch and ignore for the same sort of input.)

Fixes #1092
babel/localtime/_helpers.py
tests/test_localtime.py [new file with mode: 0644]