Issue #9005: Prevent utctimetuple() from producing year 0 or year 10,000.

This commit is contained in:
Alexander Belopolsky 2010-06-21 15:21:14 +00:00
parent c56b094bab
commit 75f94c210a
4 changed files with 31 additions and 36 deletions

View file

@ -974,10 +974,10 @@ Instance methods:
``d.dst()`` returns. DST is never in effect for a UTC time.
If *d* is aware, *d* is normalized to UTC time, by subtracting
``d.utcoffset()``, and a :class:`time.struct_time` for the normalized time is
returned. :attr:`tm_isdst` is forced to 0. Note that the result's
:attr:`tm_year` member may be :const:`MINYEAR`\ -1 or :const:`MAXYEAR`\ +1, if
*d*.year was ``MINYEAR`` or ``MAXYEAR`` and UTC adjustment spills over a year
``d.utcoffset()``, and a :class:`time.struct_time` for the
normalized time is returned. :attr:`tm_isdst` is forced to 0. Note
that an :exc:`OverflowError` may be raised if *d*.year was
``MINYEAR`` or ``MAXYEAR`` and UTC adjustment spills over a year
boundary.