classification
Title: time.tzname returns empty string on Windows if default codepage is a Unicode codepage
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.8, Python 3.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Paul Monson, matrixise, miss-islington, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2019-05-03 00:45 by Paul Monson, last changed 2019-06-13 13:42 by miss-islington. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13073 merged matrixise, 2019-05-22 06:45
PR 14032 merged miss-islington, 2019-06-12 23:13
PR 14057 merged miss-islington, 2019-06-13 13:23
Messages (5)
msg341318 - (view) Author: Paul Monson (Paul Monson) * Date: 2019-05-03 00:45
Need to work around a CRT bug in the use of _tzset() + _tzname[] 
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.

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
msg343148 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-05-22 06:48
Hi Paul,

I have added your PR at this issue, it was assigned to another bpo issue.
msg345426 - (view) Author: miss-islington (miss-islington) Date: 2019-06-12 23:13
New changeset b4c7defe58695a6670a8fdeaef67a638bbb47e42 by Miss Islington (bot) (Paul Monson) in branch 'master':
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
https://github.com/python/cpython/commit/b4c7defe58695a6670a8fdeaef67a638bbb47e42
msg345515 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-06-13 13:22
New changeset 0a9baec16c17d261377fb8a31a57d8c397e25af6 by Victor Stinner (Miss Islington (bot)) in branch '3.8':
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) (GH-14032)
https://github.com/python/cpython/commit/0a9baec16c17d261377fb8a31a57d8c397e25af6
msg345517 - (view) Author: miss-islington (miss-islington) Date: 2019-06-13 13:42
New changeset 6a433f5ae63de72a85d20b05ff826c6f72d529b7 by Miss Islington (bot) in branch '3.7':
bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
https://github.com/python/cpython/commit/6a433f5ae63de72a85d20b05ff826c6f72d529b7
History
Date User Action Args
2019-06-13 13:42:55miss-islingtonsetmessages: + msg345517
2019-06-13 13:23:33miss-islingtonsetpull_requests: + pull_request13919
2019-06-13 13:22:57vstinnersetnosy: + vstinner
messages: + msg345515
2019-06-12 23:54:23Paul Monsonsetstatus: open -> closed
stage: patch review -> resolved
2019-06-12 23:13:53miss-islingtonsetpull_requests: + pull_request13896
2019-06-12 23:13:30miss-islingtonsetnosy: + miss-islington
messages: + msg345426
2019-05-22 06:48:26matrixisesetnosy: + matrixise
messages: + msg343148
2019-05-22 06:45:29matrixisesetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request13399
2019-05-03 07:45:11SilentGhostsetversions: + Python 3.7, Python 3.8
nosy: + paul.moore, tim.golden, zach.ware, steve.dower

components: + Windows
type: behavior
stage: test needed
2019-05-03 00:47:28Paul Monsonsettitle: strptime returns empty string on Windows if default codepage is a Unicode codepage -> time.tzname returns empty string on Windows if default codepage is a Unicode codepage
2019-05-03 00:45:22Paul Monsoncreate