[Bug 207604] Re: pytz includes a hard coded list of time zone names
Launchpad Bug Tracker
207604 at bugs.launchpad.net
Sun Mar 26 04:27:47 UTC 2023
This bug was fixed in the package python-tz - 2022.7.1-2
---------------
python-tz (2022.7.1-2) unstable; urgency=medium
* Team upload.
* Dynamically determine list of available and common timezones (LP: #207604)
* Determine IANA (nee Olson) database version dynamically
* Add autopkgtests to run unittest and own regression tests
* Update homepage URL
* Bump Standards-Version to 4.6.2
-- Benjamin Drung <bdrung at debian.org> Tue, 21 Mar 2023 11:21:11 +0100
** Changed in: python-tz (Ubuntu)
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/207604
Title:
pytz includes a hard coded list of time zone names
Status in pytz:
New
Status in python-tz package in Ubuntu:
Fix Released
Status in python-tz source package in Jammy:
New
Status in python-tz source package in Kinetic:
New
Bug description:
[ Impact ]
The Debian/Ubuntu packages of pytz include a patch to not install
pytz's zoneinfo database and instead load data from the system
zoneinfo database. This keeps pytz up to date when system timezone
updates are installed which is generally a good idea.
The pytz/__init__.py includes common_timezones and all_timezones
lists, which enumerate the time zones in the database pytz was
released with. If pytz is instead using the system database, these
lists may not be correct (e.g. missing newly added time zones).
all_timezones and common_timezones should be calculated at run time.
all_timezones will need to use os.walk to discover what timezones
exist. common_timezones should be loaded from zone.tab, plus a hard
coded list of extras such as UTC and US/Eastern.
[ Test Plan ]
Two autopkgtest test cases were added:
1. Run the upstream unittests
2. Regression tests with all tests that I could come up with.
There are no manual test, because all those test should also be run
when there is a tzdata update to prevent regressions.
[ Where problems could occur ]
Dynamically determine the timezones relies on a correct environment
and can fail more easily if the environment is broken. python-tz is
used in several places (maybe in the installer). The patch might have
a performance impact, because the list of timezones is determined
completely (but only once) instead of constructing it lazy.
[ Other Info ]
Upstream recommend our approach:
https://github.com/stub42/pytz/issues/91#issuecomment-1356628324
To manage notifications about this bug go to:
https://bugs.launchpad.net/pytz/+bug/207604/+subscriptions
More information about the foundations-bugs
mailing list