[Python-checkins] cpython: Issue #9904: fix and clarify some comments + fix indentation in symtable code

eli.bendersky python-checkins at python.org
Sun Apr 10 06:33:06 CEST 2011


http://hg.python.org/cpython/rev/b6fe63c914e4
changeset:   69231:b6fe63c914e4
user:        Eli Bendersky <eliben at gmail.com>
date:        Sun Apr 10 07:37:26 2011 +0300
summary:
  Issue #9904: fix and clarify some comments + fix indentation in symtable code

files:
  Include/symtable.h |  11 +++++++----
  Python/symtable.c  |   8 ++++----
  2 files changed, 11 insertions(+), 8 deletions(-)


diff --git a/Include/symtable.h b/Include/symtable.h
--- a/Include/symtable.h
+++ b/Include/symtable.h
@@ -23,10 +23,13 @@
     PyObject *st_blocks;            /* dict: map AST node addresses
                                      *       to symbol table entries */
     PyObject *st_stack;             /* list: stack of namespace info */
-    PyObject *st_global;            /* borrowed ref to st_top->st_symbols */
-    int st_nblocks;                 /* number of blocks used */
+    PyObject *st_global;            /* borrowed ref to st_top->ste_symbols */
+    int st_nblocks;                 /* number of blocks used. kept for
+                                       consistency with the corresponding
+                                       compiler structure */
     PyObject *st_private;           /* name of current class or NULL */
-    PyFutureFeatures *st_future;    /* module's future features */
+    PyFutureFeatures *st_future;    /* module's future features that affect
+                                       the symbol table */
 };
 
 typedef struct _symtable_entry {
@@ -34,7 +37,7 @@
     PyObject *ste_id;        /* int: key in ste_table->st_blocks */
     PyObject *ste_symbols;   /* dict: variable names to flags */
     PyObject *ste_name;      /* string: name of current block */
-    PyObject *ste_varnames;  /* list of variable names */
+    PyObject *ste_varnames;  /* list of function parameters */
     PyObject *ste_children;  /* list of child blocks */
     _Py_block_ty ste_type;   /* module, class, or function */
     int ste_unoptimized;     /* false if namespace is optimized */
diff --git a/Python/symtable.c b/Python/symtable.c
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -750,7 +750,7 @@
             goto error;
     }
 
-    /* Recursively call analyze_block() on each child block.
+    /* Recursively call analyze_child_block() on each child block.
 
        newbound, newglobal now contain the names visible in
        nested blocks.  The free variables in the children will
@@ -1205,9 +1205,9 @@
     case Raise_kind:
         if (s->v.Raise.exc) {
             VISIT(st, expr, s->v.Raise.exc);
-        if (s->v.Raise.cause) {
-        VISIT(st, expr, s->v.Raise.cause);
-        }
+            if (s->v.Raise.cause) {
+                VISIT(st, expr, s->v.Raise.cause);
+            }
         }
         break;
     case TryExcept_kind:

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


More information about the Python-checkins mailing list