Mercurial > cpython-lru_cache-weakref
diff Python/_warnings.c @ 46985:d2c1ed408a1d legacy-trunk
Fix a refleak in the _warnings module.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Tue, 13 May 2008 21:32:03 +0000 |
| parents | 9130b48a7130 |
| children | 4fe192d48960 |
line wrap: on
line diff
--- a/Python/_warnings.c Tue May 13 20:57:59 2008 +0000 +++ b/Python/_warnings.c Tue May 13 21:32:03 2008 +0000 @@ -408,8 +408,10 @@ /* 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,
