[Python-checkins] cpython (3.5): Issue #25092: Fix datetime.strftime() failure when errno was already set to

steve.dower python-checkins at python.org
Wed Sep 23 02:01:57 CEST 2015


https://hg.python.org/cpython/rev/aa6b9205c120
changeset:   98174:aa6b9205c120
branch:      3.5
user:        Steve Dower <steve.dower at microsoft.com>
date:        Tue Sep 22 14:51:42 2015 -0700
summary:
  Issue #25092: Fix datetime.strftime() failure when errno was already set to EINVAL.

files:
  Misc/NEWS            |  3 +++
  Modules/timemodule.c |  3 +++
  2 files changed, 6 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,9 @@
 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
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -653,6 +653,9 @@
             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

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list