out the location of the problem. MS_WINDOWS currently implies !HAVE_WCSFTIME,
so the addition of !defined(HAVE_WCSFTIME) is for readability.
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;
!strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1]))
{
PyErr_SetString(PyExc_ValueError, "Invalid format string");
- return 0;
+ Py_DECREF(format);
+ return NULL;
}
}
#endif