[Python-Dev] Year 0 and year 10,000 in timetuple (original) (raw)
Guido van Rossum guido at python.org
Sun Jun 20 00:12:29 CEST 2010
- Previous message: [Python-Dev] Year 0 and year 10,000 in timetuple
- Next message: [Python-Dev] Year 0 and year 10,000 in timetuple
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
But what if they are used intentionally as "impossible" or sentinel values?
--Guido (on Android)
On Jun 19, 2010 2:37 PM, "Alexander Belopolsky" < alexander.belopolsky at gmail.com> wrote:
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().tmyear 0 t2.utctimetuple().tmyear 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 at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20100619/9b6ef443/attachment.html>
- Previous message: [Python-Dev] Year 0 and year 10,000 in timetuple
- Next message: [Python-Dev] Year 0 and year 10,000 in timetuple
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]