# HG changeset patch # User Steve Dower # Date 1442256956 25200 # Mon Sep 14 11:55:56 2015 -0700 # Branch 3.5 # Node ID caf97de78757af0a5e7e6b56883f8a5a19df3505 # Parent 399b7d5616f19e1799ff1dcd0206b9f54e41cc81 Issue #25092: strftime does not clear errno before calling into CRT. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,6 +14,8 @@ Library ------- +- Issue #25092: strftime does not clear errno before calling into CRT. + - Issue #24684: socket.socket.getaddrinfo() now calls PyUnicode_AsEncodedString() instead of calling the encode() method of the host, to handle correctly custom string with an encode() method which doesn't 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