[Python-checkins] cpython (3.2): Issue #14125: backport refleak fix (d4adbf908983).

stefan.krah python-checkins at python.org
Mon Feb 27 17:40:00 CET 2012


http://hg.python.org/cpython/rev/b4321f93e3f2
changeset:   75317:b4321f93e3f2
branch:      3.2
parent:      75312:b52fbbcdc8e6
user:        Stefan Krah <skrah at bytereef.org>
date:        Mon Feb 27 17:34:17 2012 +0100
summary:
  Issue #14125: backport refleak fix (d4adbf908983).

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


diff --git a/Modules/timemodule.c b/Modules/timemodule.c
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -504,7 +504,7 @@
     fmt = PyBytes_AS_STRING(format);
 #endif
 
-#if defined(MS_WINDOWS)
+#if defined(MS_WINDOWS) && !defined(HAVE_WCSFTIME)
     /* check that the format string contains only valid directives */
     for(outbuf = strchr(fmt, '%');
         outbuf != NULL;
@@ -516,7 +516,8 @@
             !strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1]))
         {
             PyErr_SetString(PyExc_ValueError, "Invalid format string");
-            return 0;
+            Py_DECREF(format);
+            return NULL;
         }
     }
 #endif

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


More information about the Python-checkins mailing list