This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: email.utils.localtime throws exception if time.daylight is False
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: Brian.Jones, r.david.murray
Priority: normal Keywords: patch

Created on 2012-03-13 00:14 by Brian.Jones, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
localtime_fix.patch Brian.Jones, 2012-03-13 00:14 patch fixing localtime throwing UnboundLocalError when time.daylight is false.
Messages (3)
msg155535 - (view) Author: Brian Jones (Brian.Jones) * Date: 2012-03-13 00:14
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.
msg155659 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-03-13 20:32
Thanks, Brian.

(For the record, this is a bug in email6 code that hasn't been checked into trunk yet.)
msg155864 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-03-15 06:11
Fixed in the email6 feature branch.  Thanks Brian.
History
Date User Action Args
2022-04-11 14:57:27adminsetgithub: 58486
2012-03-15 06:11:53r.david.murraysetstatus: open -> closed

messages: + msg155864
2012-03-15 06:09:34r.david.murraysettype: behavior
stage: resolved
resolution: fixed
assignee: r.david.murray
2012-03-15 03:42:03Brian.Jonessetnosy: + Brian.Jones
2012-03-13 20:32:44r.david.murraysetmessages: + msg155659
2012-03-13 17:06:33Brian.Jonessetnosy: + r.david.murray, - Brian.Jones
2012-03-13 00:14:00Brian.Jonescreate