While datetime range is limited to years from 1 through 9999, it is
possible to produce time tuple with year 0 or year 10,000:

>>> t1 = datetime.min.replace(tzinfo=timezone.max)
>>> t2 = datetime.max.replace(tzinfo=timezone.min)
>>> t1.utctimetuple().tm_year
0
>>> t2.utctimetuple().tm_year
10000

Most if not all functions consuming timetuples are not designed to
handle years beyond 9999 and such timetuples cannot be converted back
to datetime.

I would like to make utctimetuple() method to raise OverflowError on
values like t1 or t2 above.  These values are most certainly a mistake
in application ad it is better to detect them earlier before they make
their way into system functions that cannot handle them.

See issues 9005 and 6608 on the tracker.

http://bugs.python.org/issue9005
http://bugs.python.org/issue6608
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to