Cannot localize days on boundary of representable dates

Bug #1435758 reported by david@drmaciver.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pytz
New
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.