summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-17 18:02:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-17 18:02:44 (GMT)
commit55e00f279f6e662f0f7cfc53398fa854d9666e09 (patch)
treeea6b31b08ddcc6011d969e69feb52888e2890510 /Python
parent8ba92f65021900ac088aed3f65f8650efab5d416 (diff)
downloadcpython-55e00f279f6e662f0f7cfc53398fa854d9666e09.zip
cpython-55e00f279f6e662f0f7cfc53398fa854d9666e09.tar.gz
cpython-55e00f279f6e662f0f7cfc53398fa854d9666e09.tar.bz2
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 ........
Diffstat (limited to 'Python')
-rw-r--r--Python/symtable.c13
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))