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

zoneinfo does not support full range of allowed transition hours in fallback string #86829

Closed
pganssle opened this issue Dec 16, 2020 · 1 comment
Labels
3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@pganssle
Copy link
Member

BPO 42663
Nosy @serhiy-storchaka, @pganssle
PRs
  • bpo-42663: Fix parsing TZ strings in zoneinfo module #23825
  • 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 = None
    created_at = <Date 2020-12-16.21:33:53.471>
    labels = ['type-bug', 'library', '3.9', '3.10']
    title = 'zoneinfo does not support full range of allowed transition hours in fallback string'
    updated_at = <Date 2020-12-17.21:05:55.249>
    user = 'https://github.com/pganssle'

    bugs.python.org fields:

    activity = <Date 2020-12-17.21:05:55.249>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2020-12-16.21:33:53.471>
    creator = 'p-ganssle'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42663
    keywords = ['patch']
    message_count = 1.0
    messages = ['383206']
    nosy_count = 2.0
    nosy_names = ['serhiy.storchaka', 'p-ganssle']
    pr_nums = ['23825']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue42663'
    versions = ['Python 3.9', 'Python 3.10']

    @pganssle
    Copy link
    Member Author

    TZif files consist of a list of transitions followed by a POSIX TZ var-style string of a form like "AAA3BBB,M3.2.0/01:30,M11.1.0/02:15:45", which decodes to "AAA (UTC-3) is the standard time and BBB (UTC-2) is the DST time, DST applies starting at 02:15:45 local time on the 1st Sunday in November and ending at 1:30:00 local time on the 2nd Sunday in March". After the last listed transition, the rule specified by the TZ variable applies.

    POSIX says that the "hours" part of the transition rule must be in the range ±24, but as mentioned in a TODO comment in _zoneinfo.c, RFC 8536 §3.3.1 specifies that the hours part of transition times may range from -167 to 167 (see: https://github.com/python/cpython/blob/master/Modules/_zoneinfo.c#L1844-L1847 ).

    Currently, zoneinfo does not support the full range of possible transitions, and a TZif file with a 3-digit transition hour would likely fail to parse. This isn't a terribly high priority at the moment, but if the tz project ever releases a TZif file with one of these TZ strings on it, it will all of a sudden become very critical to fix it, so we should probably try to get it fixed before Python 3.9 is EOL, so that all versions of Python with zoneinfo can handle this properly.

    @pganssle pganssle added 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Dec 16, 2020
    @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.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    Archived in project
    Development

    No branches or pull requests

    2 participants