[Python-checkins] cpython: only incref when using borrowing functions

benjamin.peterson python-checkins at python.org
Thu Apr 26 06:27:16 CEST 2012


http://hg.python.org/cpython/rev/1e44f3ee5bd3
changeset:   76567:1e44f3ee5bd3
parent:      76558:5fea362b92fc
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Apr 26 00:26:37 2012 -0400
summary:
  only incref when using borrowing functions

files:
  Python/ceval.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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();
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list