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

email.utils.localtime throws exception if time.daylight is False #58486

Closed
BrianJones mannequin opened this issue Mar 13, 2012 · 3 comments
Closed

email.utils.localtime throws exception if time.daylight is False #58486

BrianJones mannequin opened this issue Mar 13, 2012 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@BrianJones
Copy link
Mannequin

BrianJones mannequin commented Mar 13, 2012

BPO 14278
Nosy @bitdancer
Files
  • localtime_fix.patch: patch fixing localtime throwing UnboundLocalError when time.daylight is false.
  • 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 = 'https://github.com/bitdancer'
    closed_at = <Date 2012-03-15.06:11:53.769>
    created_at = <Date 2012-03-13.00:14:00.921>
    labels = ['type-bug', 'library']
    title = 'email.utils.localtime throws exception if time.daylight is False'
    updated_at = <Date 2012-03-15.06:11:53.767>
    user = 'https://bugs.python.org/BrianJones'

    bugs.python.org fields:

    activity = <Date 2012-03-15.06:11:53.767>
    actor = 'r.david.murray'
    assignee = 'r.david.murray'
    closed = True
    closed_date = <Date 2012-03-15.06:11:53.769>
    closer = 'r.david.murray'
    components = ['Library (Lib)']
    creation = <Date 2012-03-13.00:14:00.921>
    creator = 'Brian.Jones'
    dependencies = []
    files = ['24808']
    hgrepos = []
    issue_num = 14278
    keywords = ['patch']
    message_count = 3.0
    messages = ['155535', '155659', '155864']
    nosy_count = 2.0
    nosy_names = ['r.david.murray', 'Brian.Jones']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue14278'
    versions = ['Python 3.3']

    @BrianJones
    Copy link
    Mannequin Author

    BrianJones mannequin commented Mar 13, 2012

    In email.utils.localtime, there's a variable 'offset' that will only exist if time.daylight evaluates to True. If time.daylight evaluates to False, you'll get an UnboundLocalError, because 'offset' is being referenced without being assigned.

    The attached patch fixes that issue, adds several tests, and also refactors an existing test containing 4-5 assertions into a test for each assertion.

    @BrianJones BrianJones mannequin added the stdlib Python modules in the Lib dir label Mar 13, 2012
    @bitdancer
    Copy link
    Member

    Thanks, Brian.

    (For the record, this is a bug in email6 code that hasn't been checked into trunk yet.)

    @bitdancer bitdancer self-assigned this Mar 15, 2012
    @bitdancer bitdancer added the type-bug An unexpected behavior, bug, or error label Mar 15, 2012
    @bitdancer
    Copy link
    Member

    Fixed in the email6 feature branch. Thanks Brian.

    @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
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant