Sitelet https://github.com/python/cpython/issues/55143
Skip to content

imaplib: Internaldate2tuple() is documented to return UTC, but it returns local time #55143

Description

@lavajoe
mannequin
BPO 10934
Nosy @abalkin
Files
  • imaplib_Internaldate2tuple_doc_python32.patch
  • imaplib_Internaldate2tuple_doc_python27.patch
  • issue10934.diff
  • 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 2011-01-19.21:48:54.412>
    created_at = <Date 2011-01-18.13:46:04.849>
    labels = ['docs']
    title = 'imaplib: Internaldate2tuple() is documented to return UTC, but it returns local time'
    updated_at = <Date 2011-01-19.21:48:54.410>
    user = 'https://bugs.python.org/lavajoe'

    bugs.python.org fields:

    activity = <Date 2011-01-19.21:48:54.410>
    actor = 'belopolsky'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2011-01-19.21:48:54.412>
    closer = 'belopolsky'
    components = ['Documentation']
    creation = <Date 2011-01-18.13:46:04.849>
    creator = 'lavajoe'
    dependencies = []
    files = ['20438', '20439', '20457']
    hgrepos = []
    issue_num = 10934
    keywords = ['patch']
    message_count = 5.0
    messages = ['126463', '126557', '126559', '126560', '126570']
    nosy_count = 3.0
    nosy_names = ['belopolsky', 'docs@python', 'lavajoe']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue10934'
    versions = ['Python 2.7', 'Python 3.2']

    Activity

    1. lavajoe commented on Jan 18, 2011

      lavajoemannequin
      MannequinAuthor

      Patched documentation for Internaldate2tuple() to correctly state it returns local time.

      Also, Time2Internaldate() (its inverse) did not state that it needs local time as input, so patched this as well.

      Patches for 3.2 and 2.7 are attached.

    2. abalkin commented on Jan 19, 2011

      @abalkin
      Member

      It makes sense that Internaldate2tuple() returns local time because timetuple (with its tm_isdst flag) strongly suggests local time. (See also bpo-9004.)

      If UTC or any other timezone time is needed, it would be best to provide a function that would return an aware datetime object.

      I made some changes to Joe's patch in attached diff. I would appreciate another pair of eyes to look at it before I commit.

    3. lavajoe commented on Jan 19, 2011

      lavajoemannequin
      MannequinAuthor

      Hey Alexander,

      Looks great. Just a few small things:

      • In hunk 2 of the imaplib.rst file patch section, insert word "to" (i.e. "Convert date_time to an IMAP4 INTERNALDATE representation.")

      • Two lines, down there's only one space at end of sentence: "double-quotes). The" (all other places have 2 spaces).

      • In first hunk of imaplib.py patch section, there is a period that does not belong after "tuple": "time.struct_time tuple. or None"

      That's all I saw! Thanks for expanding on the doc!

    4. abalkin commented on Jan 19, 2011

      @abalkin
      Member

      Committed in revision 88114.

    5. abalkin commented on Jan 19, 2011

      @abalkin
      Member

      Merged to 2.7 in revision 88116.

    6. transferred this issue fromon Apr 10, 2022
    7. added a commit that references this issue on Jun 15, 2026
    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

      docsDocumentation in the Doc dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions