[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

Eryk Sun report at bugs.python.org
Sat Mar 6 11:21:56 EST 2021


Eryk Sun <eryksun at gmail.com> added the comment:

The solution for bpo-36779 changed init_timezone() to get tzname directly from WinAPI GetTimeZoneInformation(). 

Unfortunately the implementer didn't think to also support time.tzset(), so the value may be stale with no way to refresh it, or possibly different from what time.strftime('%Z') returns, depending on when ucrt looks up the timezone. For example, start Python and import time. Then change the time zone and call time.strftime('%Z'). The value will be different from time.tzname.

----------
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> time.tzname returns empty string on Windows if default codepage is a Unicode codepage

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue16322>
_______________________________________


More information about the Python-bugs-list mailing list