]> granicus.if.org Git - python/commitdiff
Jim Fulton writes:
authorGuido van Rossum <guido@python.org>
Thu, 22 Oct 1998 15:46:50 +0000 (15:46 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 22 Oct 1998 15:46:50 +0000 (15:46 +0000)
"""
I had originally not realized that PyEval_GetGlobals did not
INCREF it's return value.  The fix is to add the INCREF,
as shown below.
"""

Python/import.c

index 0bf5d47cfba780e17c01d2517d61d014936cb1f9..2707019414502ce47f9379fc7c878499d1ca5174 100644 (file)
@@ -1858,6 +1858,7 @@ PyImport_Import(module_name)
        /* Get the builtins from current globals */
        globals = PyEval_GetGlobals();
        if(globals != NULL) {
+               Py_INCREF(globals);
                builtins = PyObject_GetItem(globals, builtins_str);
                if (builtins == NULL)
                        goto err;