summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-17 22:39:21 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-17 22:39:21 (GMT)
commit55329f8fbd7d4beb1483705f8a7bf1419e2eaba6 (patch)
tree9107ea9d0fb5cfa8c39f9ea433a31d5a423dadde /Modules
parentb6e622d184604771088b5d2dd4f4cf0cddb2a3ae (diff)
downloadcpython-55329f8fbd7d4beb1483705f8a7bf1419e2eaba6.zip
cpython-55329f8fbd7d4beb1483705f8a7bf1419e2eaba6.tar.gz
cpython-55329f8fbd7d4beb1483705f8a7bf1419e2eaba6.tar.bz2
Issue #19634: time.strftime("%y") now raises a ValueError on AIX when given a
year before 1900.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 2e48007..32fe6a7 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -650,6 +650,20 @@ time_strftime(PyObject *self, PyObject *args)
return NULL;
}
}
+#elif defined(_AIX)
+ for(outbuf = wcschr(fmt, '%');
+ outbuf != NULL;
+ outbuf = wcschr(outbuf+2, '%'))
+ {
+ /* Issue #19634: On AIX, wcsftime("y", (1899, 1, 1, 0, 0, 0, 0, 0, 0))
+ returns "0/" instead of "99" */
+ if (outbuf[1] == L'y' && buf.tm_year < 0) {
+ PyErr_SetString(PyExc_ValueError,
+ "format %y requires year >= 1900 on AIX");
+ Py_DECREF(format);
+ return NULL;
+ }
+ }
#endif
fmtlen = time_strlen(fmt);