Skip to content

time.tzname returns empty string on Windows if default codepage is a Unicode codepage #80960

Closed

Description

@paulmon
mannequin
BPO 36779
Nosy @pfmoore, @vstinner, @tjguk, @zware, @zooba, @matrixise, @miss-islington, @paulmon
PRs
  • bpo-36779: time.tzname returns empty string on Windows if default cod… #13073
  • [3.8] bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) #14032
  • [3.7] bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073) #14057
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-06-12.23:54:23.769>
    created_at = <Date 2019-05-03.00:45:22.319>
    labels = ['3.8', 'type-bug', '3.7', 'OS-windows']
    title = 'time.tzname returns empty string on Windows if default codepage is a Unicode codepage'
    updated_at = <Date 2021-03-08.18:25:28.786>
    user = 'https://github.com/paulmon'

    bugs.python.org fields:

    activity = <Date 2021-03-08.18:25:28.786>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-12.23:54:23.769>
    closer = 'Paul Monson'
    components = ['Windows']
    creation = <Date 2019-05-03.00:45:22.319>
    creator = 'Paul Monson'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36779
    keywords = ['patch']
    message_count = 5.0
    messages = ['341318', '343148', '345426', '345515', '345517']
    nosy_count = 8.0
    nosy_names = ['paul.moore', 'vstinner', 'tim.golden', 'zach.ware', 'steve.dower', 'matrixise', 'miss-islington', 'Paul Monson']
    pr_nums = ['13073', '14032', '14057']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36779'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. paulmon commented on May 3, 2019

      paulmonmannequin
      MannequinAuthor

      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

    2. changed the title [-]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[/+] on May 3, 2019
    3. matrixise commented on May 22, 2019

      @matrixise
      Member

      Hi Paul,

      I have added your PR at this issue, it was assigned to another bpo issue.

    4. miss-islington commented on Jun 12, 2019

      @miss-islington
      Contributor

      New changeset b4c7def by Miss Islington (bot) (Paul Monson) in branch 'master':
      bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
      b4c7def

    5. vstinner commented on Jun 13, 2019

      @vstinner
      Member

      New changeset 0a9baec 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)
      0a9baec

    6. miss-islington commented on Jun 13, 2019

      @miss-islington
      Contributor

      New changeset 6a433f5 by Miss Islington (bot) in branch '3.7':
      bpo-36779: time.tzname returns empty string on Windows if default cod… (GH-13073)
      6a433f5

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions