Commit 502168a8 authored by Raymond Hettinger's avatar Raymond Hettinger

SF patch #718867: Fix reference leak for time.strptime

(contributed by Brett Cannon)
parent 7b5ce7f2
......@@ -454,10 +454,13 @@ static PyObject *
time_strptime(PyObject *self, PyObject *args)
{
PyObject *strptime_module = PyImport_ImportModule("_strptime");
PyObject *strptime_result;
if (!strptime_module)
return NULL;
return PyObject_CallMethod(strptime_module, "strptime", "O", args);
strptime_result = PyObject_CallMethod(strptime_module, "strptime", "O", args);
Py_DECREF(strptime_module);
return strptime_result;
}
#endif /* !HAVE_STRPTIME */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment