Martin Panter added the comment:

The problem is probably triggered by the test in test_imaplib which sets the 
timezone to “STD-1DST”. It was added in revision 42b9d9d795f7, in 2012 for 
Python 3.3 only, which explains why we don’t have any trouble with Python 2.

I am no expert on time zone settings, but this either looks like a bug or 
unfortunate quirk in the C library. I only have the Gnu library handy to play 
with at the moment. Using my demo C program, it looks like tzset() fails to 
update tzname if both (1) New York time is set rather than UTC and (2) the 
temporary TZ value did not include DST rules:

$ sudo timedatectl status  # Note UTC time zone
      Local time: Sun 2015-11-15 00:16:54 UTC
  Universal time: Sun 2015-11-15 00:16:54 UTC
        RTC time: Sun 2015-11-15 00:16:54
       Time zone: UTC (UTC, +0000)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: no
$ sudo timedatectl set-timezone America/New_York
$ ./tz-quirk "STD-1DST"
Initially: TZ=<unset> tzname={"GMT", "GMT"}
After tzset(): TZ=<unset> tzname={"EST", "EDT"}
Set TZ: TZ="STD-1DST" tzname={"STD", "DST"}
Unset TZ: TZ=<unset> tzname={"STD", "DST"}

If you include DST rules in the TZ value, the problem does not occur. Maybe 
this could be a good enough workaround:

$ ./tz-quirk "STD-1DST,M3.2.0,M11.1.0"
Initially: TZ=<unset> tzname={"GMT", "GMT"}
After tzset(): TZ=<unset> tzname={"EST", "EDT"}
Set TZ: TZ="STD-1DST,M3.2.0,M11.1.0" tzname={"STD", "DST"}
Unset TZ: TZ=<unset> tzname={"EST", "EDT"}

$ sudo timedatectl set-timezone UTC  # Restore my setting
$ pacman -Qo /lib/libc.so.6
/usr/lib/libc.so.6 is owned by glibc 2.22-3

----------
components: +Tests
nosy: +martin.panter
title: TarFile.list() outputs wrong time -> test_datetime, test_tarfile, 
test_strptime time zone failures
versions: +Python 3.6
Added file: http://bugs.python.org/file41046/tz-quirk.c

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20220>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to