[Python-checkins] cpython: move more variable declarations to the top of blocks

benjamin.peterson python-checkins at python.org
Fri Oct 12 17:41:23 CEST 2012


http://hg.python.org/cpython/rev/fb40d0ab0c77
changeset:   79695:fb40d0ab0c77
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Oct 12 11:40:01 2012 -0400
summary:
  move more variable declarations to the top of blocks

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


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1834,13 +1834,14 @@
         TARGET(PRINT_EXPR) {
             PyObject *value = POP();
             PyObject *hook = PySys_GetObject("displayhook");
+            PyObject *res;
             if (hook == NULL) {
                 PyErr_SetString(PyExc_RuntimeError,
                                 "lost sys.displayhook");
                 Py_DECREF(value);
                 goto error;
             }
-            PyObject *res = PyObject_CallFunctionObjArgs(hook, value, NULL);
+            res = PyObject_CallFunctionObjArgs(hook, value, NULL);
             Py_DECREF(value);
             if (res == NULL)
                 goto error;
@@ -2394,7 +2395,7 @@
             _Py_IDENTIFIER(__import__);
             PyObject *name = GETITEM(names, oparg);
             PyObject *func = _PyDict_GetItemId(f->f_builtins, &PyId___import__);
-            PyObject *from, *level, *args;
+            PyObject *from, *level, *args, *res;
             if (func == NULL) {
                 PyErr_SetString(PyExc_ImportError,
                                 "__import__ not found");
@@ -2426,7 +2427,7 @@
                 goto error;
             }
             READ_TIMESTAMP(intr0);
-            PyObject *res = PyEval_CallObject(func, args);
+            res = PyEval_CallObject(func, args);
             READ_TIMESTAMP(intr1);
             Py_DECREF(args);
             Py_DECREF(func);

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


More information about the Python-checkins mailing list