diff options
author | Larry Hastings <larry@hastings.org> | 2015-09-09 13:52:38 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2015-09-09 13:52:38 (GMT) |
commit | ded28e386349f9cd3cb883d9873d9d10ffabe86f (patch) | |
tree | ff4d62f3abd0779b524358d3a3f0e1d96bda8237 /Modules | |
parent | f03d50c5da227fe1066f2ce9692e4c5590a8b868 (diff) | |
parent | 03728fac15204428ac4282710944170cb8f0b613 (diff) | |
download | cpython-ded28e386349f9cd3cb883d9873d9d10ffabe86f.zip cpython-ded28e386349f9cd3cb883d9873d9d10ffabe86f.tar.gz cpython-ded28e386349f9cd3cb883d9873d9d10ffabe86f.tar.bz2 |
Merge Python 3.5.0rc4 back to hg.python.org.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/timemodule.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index eca67d9..9de3c84 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -648,9 +648,6 @@ time_strftime(PyObject *self, PyObject *args) * will be ahead of time... */ for (i = 1024; ; i += i) { -#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__) - int err; -#endif outbuf = (time_char *)PyMem_Malloc(i*sizeof(time_char)); if (outbuf == NULL) { PyErr_NoMemory(); @@ -660,10 +657,14 @@ time_strftime(PyObject *self, PyObject *args) buflen = format_time(outbuf, i, fmt, &buf); _Py_END_SUPPRESS_IPH #if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__) - err = errno; + /* VisualStudio .NET 2005 does this properly */ + if (buflen == 0 && errno == EINVAL) { + PyErr_SetString(PyExc_ValueError, "Invalid format string"); + PyMem_Free(outbuf); + break; + } #endif - if (buflen > 0 || fmtlen == 0 || - (fmtlen > 4 && i >= 256 * fmtlen)) { + if (buflen > 0 || i >= 256 * fmtlen) { /* If the buffer is 256 times as long as the format, it's probably not failing for lack of room! More likely, the format yields an empty result, @@ -679,13 +680,6 @@ time_strftime(PyObject *self, PyObject *args) break; } PyMem_Free(outbuf); -#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__) - /* VisualStudio .NET 2005 does this properly */ - if (buflen == 0 && err == EINVAL) { - PyErr_SetString(PyExc_ValueError, "Invalid format string"); - break; - } -#endif } #ifdef HAVE_WCSFTIME PyMem_Free(format); |