Fix a refleak in the _warnings module.

This commit is contained in:
Georg Brandl 2008-05-13 21:32:03 +00:00
parent 18eb1fa2dd
commit 9c5b51541c
1 changed files with 3 additions and 1 deletions

View 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,