Commit d7a034bd authored by Victor Stinner's avatar Victor Stinner

(Merge 3.3) Fix time.strftime("%Y") on AIX: raise a ValueError for year > 9999

time.strtime("%Y") returned "2345" when formatting year 12345.
parents 7e00151e 36b82d85
...@@ -598,7 +598,7 @@ time_strftime(PyObject *self, PyObject *args) ...@@ -598,7 +598,7 @@ time_strftime(PyObject *self, PyObject *args)
else if (!gettmarg(tup, &buf) || !checktm(&buf)) else if (!gettmarg(tup, &buf) || !checktm(&buf))
return NULL; return NULL;
#if defined(_MSC_VER) || defined(sun) #if defined(_MSC_VER) || defined(sun) || defined(_AIX)
if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) { if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"strftime() requires year in [1; 9999]"); "strftime() requires year in [1; 9999]");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment