Skip to content

Commit a1c8777

Browse files
author
georg.brandl
committed
Fix a refleak in the _warnings module.
git-svn-id: http://svn.python.org/projects/python/trunk@63211 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 6f21a38 commit a1c8777

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/_warnings.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,10 @@ warn_explicit(PyObject *category, PyObject *message,
408408
/* A proper implementation of warnings.showwarning() should
409409
have at least two default arguments. */
410410
if ((defaults == NULL) || (PyTuple_Size(defaults) < 2)) {
411-
if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0)
411+
if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0) {
412+
Py_DECREF(show_fxn);
412413
goto cleanup;
414+
}
413415
}
414416
res = PyObject_CallFunctionObjArgs(show_fxn, message, category,
415417
filename, lineno_obj,

0 commit comments

Comments
 (0)