Issue #25092: Fix datetime.strftime() failure when errno was already set to EINVAL.
authorSteve Dower <steve.dower@microsoft.com>
Tue, 22 Sep 2015 21:51:42 +0000 (14:51 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Tue, 22 Sep 2015 21:51:42 +0000 (14:51 -0700)
Misc/NEWS
Modules/timemodule.c

index 882e310c53365c69be337130c87b8c246f99e7ce..487611388e4cda130068b55c768c50caad9bf2dd 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #25092: Fix datetime.strftime() failure when errno was already set to
+  EINVAL.
+
 - Issue #23517: Fix rounding in fromtimestamp() and utcfromtimestamp() methods
   of datetime.datetime: microseconds are now rounded to nearest with ties
   going to nearest even integer (ROUND_HALF_EVEN), instead of being rounding
index 9de3c843322e6f9df36a9722f9fc59bd4fcfedb8..d2caacdc6dd8dd968bf8f59d626630202b09f345 100644 (file)
@@ -653,6 +653,9 @@ time_strftime(PyObject *self, PyObject *args)
             PyErr_NoMemory();
             break;
         }
+#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
+        errno = 0;
+#endif
         _Py_BEGIN_SUPPRESS_IPH
         buflen = format_time(outbuf, i, fmt, &buf);
         _Py_END_SUPPRESS_IPH