summaryrefslogtreecommitdiff
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-11-19 23:58:29 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2005-11-19 23:58:29 +0000
commit4737b2348b197d21deffbf12ff23488918e9b9d4 (patch)
tree9c29fa5ebd3a8ac795553617ce4456c83c18a578 /Python/symtable.c
parent5040fee5c13cf0a795d5324de959aaf8c24c5116 (diff)
downloadcpython-git-4737b2348b197d21deffbf12ff23488918e9b9d4.tar.gz
Last batch of ref leaks in new AST code.
Also converted a bunch of assert(0) to SystemError's. There are still printfs, etc that need to be cleaned up.
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index fad7cec638..9eff3344b9 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -731,7 +731,6 @@ symtable_enter_block(struct symtable *st, identifier name, _Py_block_ty block,
if (st->st_cur) {
prev = st->st_cur;
if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) {
- Py_DECREF(st->st_cur);
return 0;
}
Py_DECREF(st->st_cur);
@@ -814,6 +813,7 @@ symtable_add_def(struct symtable *st, PyObject *name, int flag)
}
Py_DECREF(o);
}
+ Py_DECREF(mangled);
return 1;
error:
@@ -1087,9 +1087,10 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]",
++st->st_cur->ste_tmpname);
- tmp = PyString_FromString(tmpname);
+ tmp = PyString_InternFromString(tmpname);
if (!symtable_add_def(st, tmp, DEF_LOCAL))
return 0;
+ Py_DECREF(tmp);
VISIT(st, expr, e->v.ListComp.elt);
VISIT_SEQ(st, comprehension, e->v.ListComp.generators);
break;
@@ -1186,8 +1187,10 @@ symtable_visit_params(struct symtable *st, asdl_seq *args, int toplevel)
}
}
else {
- /* syntax error */
- fprintf(stderr, "unexpected expr in parameter list\n");
+ PyErr_SetString(PyExc_SyntaxError,
+ "invalid expression in parameter list");
+ PyErr_SyntaxLocation(st->st_filename,
+ st->st_cur->ste_lineno);
return 0;
}
}
@@ -1279,6 +1282,7 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
return 0;
}
st->st_cur->ste_unoptimized |= OPT_IMPORT_STAR;
+ Py_DECREF(store_name);
return 1;
}
}