Merged revisions 65715,65724,65726,65732,65736-65739,65775 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65715 | benjamin.peterson | 2008-08-16 16:04:16 -0500 (Sat, 16 Aug 2008) | 1 line
add some documentation for symtable
........
r65724 | benjamin.peterson | 2008-08-16 17:11:33 -0500 (Sat, 16 Aug 2008) | 2 lines
include filename and line number in SyntaxError
........
r65726 | georg.brandl | 2008-08-16 17:37:05 -0500 (Sat, 16 Aug 2008) | 2 lines
Review symtable docs.
........
r65732 | benjamin.peterson | 2008-08-16 18:29:40 -0500 (Sat, 16 Aug 2008) | 1 line
PySTEntry's constructor is static; there's no point in a fancy API name
........
r65736 | benjamin.peterson | 2008-08-16 20:09:17 -0500 (Sat, 16 Aug 2008) | 1 line
expose PySTEntry.nested so the symtable module will work
........
r65737 | benjamin.peterson | 2008-08-16 20:17:15 -0500 (Sat, 16 Aug 2008) | 1 line
a few improvements
........
r65738 | benjamin.peterson | 2008-08-16 20:27:30 -0500 (Sat, 16 Aug 2008) | 1 line
fix compile errors
........
r65739 | benjamin.peterson | 2008-08-16 21:23:43 -0500 (Sat, 16 Aug 2008) | 1 line
uhh PySTEntry->ste_unoptimized has to be exposed too
........
r65775 | benjamin.peterson | 2008-08-17 12:13:26 -0500 (Sun, 17 Aug 2008) | 5 lines
get the symtable module back in working order
- Fix broken functions
- Add (hopefully) extensive tests
- Modernize a little
........
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 @@
{"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 @@
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 @@
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 @@
}
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))