diff -r ce67f965a37d Lib/datetime.py
--- a/Lib/datetime.py Sun Mar 08 09:42:40 2015 -0400
+++ b/Lib/datetime.py Sun Mar 08 16:43:58 2015 +0100
@@ -1394,8 +1394,8 @@
@classmethod
def utcfromtimestamp(cls, t):
"""Construct a naive UTC datetime from a POSIX timestamp."""
- t, frac = divmod(t, 1.0)
- us = int(frac * 1e6)
+ t, frac = divmod(t, 1)
+ us = int(frac * 1000000) # long form required for decimal support
# If timestamp is less than one microsecond smaller than a
# full second, us can be rounded up to 1000000. In this case,
diff -r ce67f965a37d Lib/test/datetimetester.py
--- a/Lib/test/datetimetester.py Sun Mar 08 09:42:40 2015 -0400
+++ b/Lib/test/datetimetester.py Sun Mar 08 16:43:58 2015 +0100
@@ -1807,6 +1807,8 @@
expected = time.gmtime(ts)
got = self.theclass.utcfromtimestamp(ts)
self.verify_field_equality(expected, got)
+ got = self.theclass.utcfromtimestamp(decimal.Decimal(ts))
+ self.verify_field_equality(expected, got)
# Run with US-style DST rules: DST begins 2 a.m. on second Sunday in
# March (M3.2.0) and ends 2 a.m. on first Sunday in November (M11.1.0).