[Python-checkins] cpython (3.3): Fix time.strftime("%Y") on AIX: raise a ValueError for year > 9999

victor.stinner python-checkins at python.org
Tue Jun 25 02:34:42 CEST 2013


http://hg.python.org/cpython/rev/5bf5c461ec00
changeset:   84336:5bf5c461ec00
branch:      3.3
parent:      84332:bfede07268a1
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jun 25 02:33:53 2013 +0200
summary:
  Fix time.strftime("%Y") on AIX: raise a ValueError for year > 9999

time.strtime("%Y") returned "2345" when formatting year 12345.

files:
  Modules/timemodule.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Modules/timemodule.c b/Modules/timemodule.c
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -588,7 +588,7 @@
     else if (!gettmarg(tup, &buf) || !checktm(&buf))
         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) {
         PyErr_SetString(PyExc_ValueError,
                         "strftime() requires year in [1; 9999]");

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


More information about the Python-checkins mailing list