Several 32-bit systems have issues with transitions in the year
2037. This is a bug in the system C library since time_t does not
overflow until 2038, but let's skip tests starting from 2037 to work
around those bugs.
Revert:
"Always test datetime.strftime("%4Y")
Issue #13305: Always test datetime.datetime.strftime("%4Y") for years < 1900."
In fact, strftime("%4Y") fails on most platforms.
Added an optional argument timespec to the datetime isoformat() method
to choose the precision of the time component.
Original patch by Alessandro Cucci.
of datetime.datetime: microseconds are now rounded to nearest with ties going
to nearest even integer (ROUND_HALF_EVEN), instead of being rounding towards
zero (ROUND_DOWN). It's important that these methods use the same rounding
mode than datetime.timedelta to keep the property:
(datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t)
It also the rounding mode used by round(float) for example.
Add more unit tests on the rounding mode in test_datetime.
datetime.datetime now round microseconds to nearest with ties going to nearest
even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards
-Infinity (ROUND_FLOOR).
pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix
also _PyTime_Divide() for negative numbers.
_PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing
rounding modes.
"""Issue #23517: datetime.timedelta constructor now rounds microseconds to
nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python
older than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN)."""
datetime.timedelta uses rounding mode ROUND_HALF_EVEN again.
datetime.datetime now round microseconds to nearest with ties going away from
zero (ROUND_HALF_UP), as Python 2 and Python older than 3.3, instead of
rounding towards -Infinity (ROUND_FLOOR).
with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older
than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN).
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux. The only differences I found were actually tests
that were previously *not* run.