Cannot localize days on boundary of representable dates

Bug #1435758 reported by david@drmaciver.com on 2015-03-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pytz
Undecided
Unassigned

Bug Description

Either of the following will error with an OverflowError: date value out of range:

pytz.timezone('Africa/Abidjan').localize(datetime(year=1, month=1, day=1))

pytz.timezone('Africa/Abidjan').localize(datetime(year=9999, month=12, day=31))

This is because in the localize function (tzinfo.py:309 in the 2015.2 release) you look at the previous and the next day, but those might not be representable dates.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers