summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-02-27 16:34:17 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-02-27 16:34:17 (GMT)
commit2201ecbbfc9157c91242635c42fa47da15e8d0f8 (patch)
tree9f95310fa61c245a3a2479590fb78747bd8ab328
parent982f534fabcc0e94590080d9283703175ddc91ee (diff)
downloadcpython-2201ecbbfc9157c91242635c42fa47da15e8d0f8.zip
cpython-2201ecbbfc9157c91242635c42fa47da15e8d0f8.tar.gz
cpython-2201ecbbfc9157c91242635c42fa47da15e8d0f8.tar.bz2
Issue #14125: backport refleak fix (d4adbf908983).
-rw-r--r--Modules/timemodule.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 3ab6e9b..626db3e 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -504,7 +504,7 @@ time_strftime(PyObject *self, PyObject *args)
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 @@ time_strftime(PyObject *self, PyObject *args)
!strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1]))
{
PyErr_SetString(PyExc_ValueError, "Invalid format string");
- return 0;
+ Py_DECREF(format);
+ return NULL;
}
}
#endif