diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-13 06:42:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-13 06:42:46 -0700 |
commit | 6a433f5ae63de72a85d20b05ff826c6f72d529b7 (patch) | |
tree | 4fb5698e65728a18730f80c025a85c03d0a243e4 /Misc | |
parent | 6eb2878e42152e9c45d7ee5e6f889532d753e67c (diff) | |
download | cpython-git-6a433f5ae63de72a85d20b05ff826c6f72d529b7.tar.gz |
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
(cherry picked from commit b4c7defe58695a6670a8fdeaef67a638bbb47e42)
Co-authored-by: Paul Monson <paulmon@users.noreply.github.com>
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Windows/2019-06-11-15-41-34.bpo-36779.0TMw6f.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Windows/2019-06-11-15-41-34.bpo-36779.0TMw6f.rst b/Misc/NEWS.d/next/Windows/2019-06-11-15-41-34.bpo-36779.0TMw6f.rst new file mode 100644 index 0000000000..618cfcae7b --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2019-06-11-15-41-34.bpo-36779.0TMw6f.rst @@ -0,0 +1,2 @@ +Ensure ``time.tzname`` is correct on Windows when the active code page is +set to CP_UTF7 or CP_UTF8. |