Bug 975996: Add _PyTime_DoubleToTimet to C API
New include file timefuncs.h exports private API function
_PyTime_DoubleToTimet() from timemodule.c. timemodule should export
some other functions too (look for painful bits in datetimemodule.c).
Added insane-argument checking to datetime's assorted fromtimestamp()
and utcfromtimestamp() methods. Added insane-argument tests of these
to test_datetime, and insane-argument tests for ctime(), localtime()
and gmtime() to test_time.
diff --git a/Misc/NEWS b/Misc/NEWS
index b3096ca..f2b65e6 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -228,9 +228,13 @@
Extension modules
-----------------
-- time module code that deals with time_t timestamps will now raise a
- ValueError if more than a second is lost in precision from time_t being less
- precise than a double. Closes bug #919012.
+- time module code that deals with input POSIX timestamps will now raise
+ ValueError if more than a second is lost in precision when the
+ timestamp is cast to the platform C time_t type. There's no chance
+ that the platform will do anything sensible with the result in such
+ cases. This includes ctime(), localtime() and gmtime(). Assorted
+ fromtimestamp() and utcfromtimestamp() methods in the datetime module
+ were also protected. Closes bugs #919012 and 975996.
- fcntl.ioctl now warns if the mutate flag is not specified.
@@ -555,6 +559,11 @@
C API
-----
+- Private function _PyTime_DoubleToTimet added, to convert a Python
+ timestamp (C double) to platform time_t with some out-of-bounds
+ checking. Declared in new header file timefuncs.h. It would be
+ good to expose some other internal timemodule.c functions there.
+
- New public functions PyEval_EvaluateFrame and PyGen_New to expose
generator objects.