Skip to content
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

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

Closed
paulmon mannequin opened this issue May 3, 2019 · 5 comments
Closed
Labels
3.7 (EOL) end of life 3.8 only security fixes OS-windows type-bug An unexpected behavior, bug, or error

Comments

@paulmon
Copy link
Mannequin

paulmon mannequin commented May 3, 2019

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']

    @paulmon
    Copy link
    Mannequin Author

    paulmon mannequin commented May 3, 2019

    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

    @paulmon paulmon mannequin 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 May 3, 2019
    @SilentGhost SilentGhost mannequin added OS-windows 3.7 (EOL) end of life 3.8 only security fixes type-bug An unexpected behavior, bug, or error labels May 3, 2019
    @matrixise
    Copy link
    Member

    Hi Paul,

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

    @miss-islington
    Copy link
    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

    @paulmon paulmon mannequin closed this as completed Jun 12, 2019
    @vstinner
    Copy link
    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

    @miss-islington
    Copy link
    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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants