Bug #1478429: make datetime.datetime.fromtimestamp accept every float,
possibly "rounding up" to the next whole second.
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index b7bddff..648ebe5 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -3683,6 +3683,13 @@
 		return NULL;
 	fraction = timestamp - (double)timet;
 	us = (int)round_to_long(fraction * 1e6);
+	/* If timestamp is less than one microsecond smaller than a
+	 * full second, round up. Otherwise, ValueErrors are raised
+	 * for some floats. */
+	if (us == 1000000) {
+		timet += 1;
+		us = 0;
+	}
 	return datetime_from_timet_and_us(cls, f, timet, us, tzinfo);
 }