diff Python/ceval.c @ 76567:1e44f3ee5bd3

only incref when using borrowing functions
author Benjamin Peterson <benjamin@python.org>
date Thu, 26 Apr 2012 00:26:37 -0400
parents 6e5855854a2e
children b0eb7d2a9542
line wrap: on
line diff
--- a/Python/ceval.c	Wed Apr 25 19:45:11 2012 +0200
+++ b/Python/ceval.c	Thu Apr 26 00:26:37 2012 -0400
@@ -2132,6 +2132,7 @@
                                              GLOBAL_NAME_ERROR_MSG, w);
                     break;
                 }
+                Py_INCREF(x);
             }
             else {
                 /* Slow-path if globals or builtins is not a dict */
@@ -2147,7 +2148,6 @@
                     }
                 }
             }
-            Py_INCREF(x);
             PUSH(x);
             DISPATCH();