Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.8] bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) #14032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2019

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 12, 2019

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 b4c7def)

Co-authored-by: Paul Monson [email protected]

https://bugs.python.org/issue36779

pythonGH-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 b4c7def)

Co-authored-by: Paul Monson <[email protected]>
@miss-islington
Copy link
Contributor Author

@paulmon: Status check is done, and it's a success ✅ .

2 similar comments
@miss-islington
Copy link
Contributor Author

@paulmon: Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

@paulmon: Status check is done, and it's a success ✅ .

@vstinner vstinner merged commit 0a9baec into python:3.8 Jun 13, 2019
@miss-islington miss-islington deleted the backport-b4c7def-3.8 branch June 13, 2019 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants