mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Fix a refleak in the _warnings module.
This commit is contained in:
parent
18eb1fa2dd
commit
9c5b51541c
1 changed files with 3 additions and 1 deletions
|
@ -408,8 +408,10 @@ warn_explicit(PyObject *category, PyObject *message,
|
||||||
/* A proper implementation of warnings.showwarning() should
|
/* A proper implementation of warnings.showwarning() should
|
||||||
have at least two default arguments. */
|
have at least two default arguments. */
|
||||||
if ((defaults == NULL) || (PyTuple_Size(defaults) < 2)) {
|
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;
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res = PyObject_CallFunctionObjArgs(show_fxn, message, category,
|
res = PyObject_CallFunctionObjArgs(show_fxn, message, category,
|
||||||
filename, lineno_obj,
|
filename, lineno_obj,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue