summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-13 21:32:03 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-13 21:32:03 (GMT)
commit9c5b51541cff55dacb899fb0711e675063ad0e96 (patch)
tree1d396f0bd0ea087209cfd84040a68e67a4e42c75 /Python
parent18eb1fa2dd0e4f6b80e1cc31fc712eebfc610154 (diff)
downloadcpython-9c5b51541cff55dacb899fb0711e675063ad0e96.zip
cpython-9c5b51541cff55dacb899fb0711e675063ad0e96.tar.gz
cpython-9c5b51541cff55dacb899fb0711e675063ad0e96.tar.bz2
Fix a refleak in the _warnings module.
Diffstat (limited to 'Python')
-rw-r--r--Python/_warnings.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index e75d4fd..6603bf0 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -408,8 +408,10 @@ warn_explicit(PyObject *category, PyObject *message,
/* A proper implementation of warnings.showwarning() should
have at least two default arguments. */
if ((defaults == NULL) || (PyTuple_Size(defaults) < 2)) {
- if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0)
+ if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0) {
+ Py_DECREF(show_fxn);
goto cleanup;
+ }
}
res = PyObject_CallFunctionObjArgs(show_fxn, message, category,
filename, lineno_obj,