Skip to content

Commit dd97fbb

Browse files
committed
Issue #9904: fix and clarify some comments + fix indentation in symtable code
1 parent 1929983 commit dd97fbb

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎Include/symtable.h‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@ struct symtable {
2323
PyObject *st_blocks; /* dict: map AST node addresses
2424
* to symbol table entries */
2525
PyObject *st_stack; /* list: stack of namespace info */
26-
PyObject *st_global; /* borrowed ref to st_top->st_symbols */
27-
int st_nblocks; /* number of blocks used */
26+
PyObject *st_global; /* borrowed ref to st_top->ste_symbols */
27+
int st_nblocks; /* number of blocks used. kept for
28+
consistency with the corresponding
29+
compiler structure */
2830
PyObject *st_private; /* name of current class or NULL */
29-
PyFutureFeatures *st_future; /* module's future features */
31+
PyFutureFeatures *st_future; /* module's future features that affect
32+
the symbol table */
3033
};
3134

3235
typedef struct _symtable_entry {
3336
PyObject_HEAD
3437
PyObject *ste_id; /* int: key in ste_table->st_blocks */
3538
PyObject *ste_symbols; /* dict: variable names to flags */
3639
PyObject *ste_name; /* string: name of current block */
37-
PyObject *ste_varnames; /* list of variable names */
40+
PyObject *ste_varnames; /* list of function parameters */
3841
PyObject *ste_children; /* list of child blocks */
3942
_Py_block_ty ste_type; /* module, class, or function */
4043
int ste_unoptimized; /* false if namespace is optimized */

‎Python/symtable.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free,
750750
goto error;
751751
}
752752

753-
/* Recursively call analyze_block() on each child block.
753+
/* Recursively call analyze_child_block() on each child block.
754754
755755
newbound, newglobal now contain the names visible in
756756
nested blocks. The free variables in the children will
@@ -1205,9 +1205,9 @@ symtable_visit_stmt(struct symtable *st, stmt_ty s)
12051205
case Raise_kind:
12061206
if (s->v.Raise.exc) {
12071207
VISIT(st, expr, s->v.Raise.exc);
1208-
if (s->v.Raise.cause) {
1209-
VISIT(st, expr, s->v.Raise.cause);
1210-
}
1208+
if (s->v.Raise.cause) {
1209+
VISIT(st, expr, s->v.Raise.cause);
1210+
}
12111211
}
12121212
break;
12131213
case TryExcept_kind:

0 commit comments

Comments
 (0)