[Python-checkins] r63211 - python/trunk/Python/_warnings.c

georg.brandl python-checkins at python.org
Tue May 13 23:32:04 CEST 2008


Author: georg.brandl
Date: Tue May 13 23:32:03 2008
New Revision: 63211

Log:
Fix a refleak in the _warnings module.


Modified:
   python/trunk/Python/_warnings.c

Modified: python/trunk/Python/_warnings.c
==============================================================================
--- python/trunk/Python/_warnings.c	(original)
+++ python/trunk/Python/_warnings.c	Tue May 13 23:32:03 2008
@@ -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,


More information about the Python-checkins mailing list