]> granicus.if.org Git - python/commit
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
authorPaul Monson <paulmon@users.noreply.github.com>
Wed, 12 Jun 2019 23:13:27 +0000 (16:13 -0700)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 12 Jun 2019 23:13:27 +0000 (16:13 -0700)
commitb4c7defe58695a6670a8fdeaef67a638bbb47e42
tree6cc67accc1cc7190269bca65314e2ee3fe275d17
parent95f61c8b1619e736bd5e29a0da0183234634b6e8
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)

Calling setlocale(LC_CTYPE, "") on a system where GetACP() returns CP_UTF8 results in empty strings in _tzname[].

This causes time.tzname to be an empty string.
I have reported the bug to the UCRT team and will follow up, but it will take some time get a fix into production.

In the meantime one possible workaround is to temporarily change the locale by calling setlocale(LC_CTYPE, "C") before calling _tzset and restore the current locale after if the GetACP() == CP_UTF8 or CP_UTF7

@zooba

https://bugs.python.org/issue36779
Misc/NEWS.d/next/Windows/2019-06-11-15-41-34.bpo-36779.0TMw6f.rst [new file with mode: 0644]
Modules/timemodule.c