diff options
Diffstat (limited to 'Python/symtable.c')
-rw-r--r-- | Python/symtable.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index 92432ab..e3bb270 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -22,9 +22,9 @@ #define RETURN_VAL_IN_GENERATOR \ "'return' with argument inside generator" -/* XXX(nnorwitz): change name since static? */ + static PySTEntryObject * -PySTEntry_New(struct symtable *st, identifier name, _Py_block_ty block, +ste_new(struct symtable *st, identifier name, _Py_block_ty block, void *key, int lineno) { PySTEntryObject *ste = NULL; @@ -114,6 +114,8 @@ static PyMemberDef ste_memberlist[] = { {"symbols", T_OBJECT, OFF(ste_symbols), READONLY}, {"varnames", T_OBJECT, OFF(ste_varnames), READONLY}, {"children", T_OBJECT, OFF(ste_children), READONLY}, + {"optimized",T_INT, OFF(ste_unoptimized), READONLY}, + {"nested", T_INT, OFF(ste_nested), READONLY}, {"type", T_INT, OFF(ste_type), READONLY}, {"lineno", T_INT, OFF(ste_lineno), READONLY}, {NULL} @@ -388,6 +390,9 @@ analyze_name(PySTEntryObject *ste, PyObject *scopes, PyObject *name, long flags, PyErr_Format(PyExc_SyntaxError, "name '%U' is parameter and global", name); + PyErr_SyntaxLocation(ste->ste_table->st_filename, + ste->ste_lineno); + return 0; } if (flags & DEF_NONLOCAL) { @@ -788,7 +793,7 @@ symtable_warn(struct symtable *st, char *msg, int lineno) return 1; } -/* symtable_enter_block() gets a reference via PySTEntry_New(). +/* symtable_enter_block() gets a reference via ste_new. This reference is released when the block is exited, via the DECREF in symtable_exit_block(). */ @@ -825,7 +830,7 @@ symtable_enter_block(struct symtable *st, identifier name, _Py_block_ty block, } Py_DECREF(st->st_cur); } - st->st_cur = PySTEntry_New(st, name, block, ast, lineno); + st->st_cur = ste_new(st, name, block, ast, lineno); if (st->st_cur == NULL) return 0; if (name == GET_IDENTIFIER(top)) |