diff Python/_warnings.c @ 46445:6e4ca9f72bba legacy-trunk

Correct a refleak found by "regrtest.py -R:: test_structmembers" Some other minor updates in _warnings.c: - make a function static - rename a shadowing local variable
author Amaury Forgeot d'Arc <amauryfa@gmail.com>
date Mon, 14 Apr 2008 20:07:48 +0000
parents 052827900782
children d58ec38e6db1
line wrap: on
line diff
--- a/Python/_warnings.c	Mon Apr 14 19:55:40 2008 +0000
+++ b/Python/_warnings.c	Mon Apr 14 20:07:48 2008 +0000
@@ -61,7 +61,7 @@
 }
 
 
-PyObject *
+static PyObject *
 get_once_registry(void)
 {
     PyObject *registry;
@@ -378,16 +378,17 @@
             show_warning(filename, lineno, text, category, sourceline);
         }
         else {
-            PyObject *result;
+            PyObject *res;
             
-            result = PyObject_CallFunctionObjArgs(show_fxn, message, category,
+            res = PyObject_CallFunctionObjArgs(show_fxn, message, category,
                                                     filename, lineno_obj,
                                                     Py_None,
                                                     sourceline ?
                                                         sourceline: Py_None,
                                                     NULL);
-            Py_XDECREF(result);
-            if (result == NULL)
+            Py_DECREF(show_fxn);
+            Py_XDECREF(res);
+            if (res == NULL)
                 goto cleanup;
         }
     }