Comment 9 for bug 1992692

Revision history for this message
Steve Beattie (sbeattie) wrote :

FYI, because of the way python has incorrectly handled timezomes in the past, the python3-icu tests fail, at least when run in a timezone that is -0700 for releases like bionic and older. For example, taking the very similar testcase for the prior 2022c update in LP: #1986984, on ubuntu 18.04 it results:

ubuntu@sec-bionic-amd64:~$ apt policy tzdata | grep Installed:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

  Installed: 2022c-0ubuntu0.18.04.0
ubuntu@sec-bionic-amd64:~$ python3
Python 3.6.9 (default, Jun 29 2022, 11:45:57)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> from icu import ICUtzinfo, TimeZone
>>> tz = ICUtzinfo(TimeZone.createTimeZone("America/Santiago"))
>>> always_before = datetime(2022, 9, 1)
>>> now_before = datetime(2022, 9, 8)
>>> always_after = datetime(2022, 9, 12)
>>> assert(tz.utcoffset(always_before) == tz.utcoffset(now_before))
>>> assert(tz.utcoffset(now_before) != tz.utcoffset(always_after))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
>>> tz.utcoffset(now_before)
datetime.timedelta(-1, 75600)
>>> tz.utcoffset(always_after)
datetime.timedelta(-1, 75600)

For ensuring the ESM releases were handling the changes correctly, I created a python3-tz[1] based script at https://git.launchpad.net/qa-regression-testing/tree/scripts/test-tzdata.py and in fact, just pushed an added testcase for this bug that looks like https://git.launchpad.net/qa-regression-testing/tree/scripts/test-tzdata.py#n95

Thanks.

[1] The pytz project documents a lot of the issues with timezone handling in older pythons at their project page: https://pytz.sourceforge.net/