summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-04-10 16:03:22 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-04-10 16:03:22 (GMT)
commit502168a86e4c0bce83f491879fcf02836bc0fbb2 (patch)
tree7b5a5f65eb7cbc4271c7f7580701f0ef98dae38d /Modules/timemodule.c
parent7b5ce7f25a353fbf6516592f3fdcc9f10224ecb1 (diff)
downloadcpython-502168a86e4c0bce83f491879fcf02836bc0fbb2.zip
cpython-502168a86e4c0bce83f491879fcf02836bc0fbb2.tar.gz
cpython-502168a86e4c0bce83f491879fcf02836bc0fbb2.tar.bz2
SF patch #718867: Fix reference leak for time.strptime
(contributed by Brett Cannon)
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index fc81ca4..2e28d95 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -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 */