summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-09-22 14:51:42 -0700
committerSteve Dower <steve.dower@microsoft.com>2015-09-22 14:51:42 -0700
commit57ab1cdb152bdb223555ca2f46de06e3e26485dd (patch)
treee8849d8a9720aa774662027fea68c8f462e25d7b
parent3a0f471e5f14a0b49651bcebc15c721c5c82d28b (diff)
downloadcpython-git-57ab1cdb152bdb223555ca2f46de06e3e26485dd.tar.gz
Issue #25092: Fix datetime.strftime() failure when errno was already set to EINVAL.
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/timemodule.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 882e310c53..487611388e 100644
--- 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
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 9de3c84332..d2caacdc6d 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -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