mirror of https://github.com/python/cpython
Issue #14125: backport refleak fix (d4adbf908983).
This commit is contained in:
parent
982f534fab
commit
2201ecbbfc
|
@ -504,7 +504,7 @@ time_strftime(PyObject *self, PyObject *args)
|
||||||
fmt = PyBytes_AS_STRING(format);
|
fmt = PyBytes_AS_STRING(format);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MS_WINDOWS)
|
#if defined(MS_WINDOWS) && !defined(HAVE_WCSFTIME)
|
||||||
/* check that the format string contains only valid directives */
|
/* check that the format string contains only valid directives */
|
||||||
for(outbuf = strchr(fmt, '%');
|
for(outbuf = strchr(fmt, '%');
|
||||||
outbuf != NULL;
|
outbuf != NULL;
|
||||||
|
@ -516,7 +516,8 @@ time_strftime(PyObject *self, PyObject *args)
|
||||||
!strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1]))
|
!strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1]))
|
||||||
{
|
{
|
||||||
PyErr_SetString(PyExc_ValueError, "Invalid format string");
|
PyErr_SetString(PyExc_ValueError, "Invalid format string");
|
||||||
return 0;
|
Py_DECREF(format);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue