]> granicus.if.org Git - python/commitdiff
Fix a refleak in the _warnings module.
authorGeorg Brandl <georg@python.org>
Tue, 13 May 2008 21:32:03 +0000 (21:32 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 13 May 2008 21:32:03 +0000 (21:32 +0000)
Python/_warnings.c

index e75d4fd06a635c023202aa870aa635f0d9193759..6603bf02f98c023e7c0166c685f8d9d63b9ef7b9 100644 (file)
@@ -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,