summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-19 04:52:03 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-19 04:52:03 (GMT)
commit7605936deeeb2fac75b209895717e7798f7a306f (patch)
treefb536ebcf433fde393c9d1c04a50d72d361c46bf /Python
parent7fd9607badee68dbc679017ab962b99e5c265eca (diff)
downloadcpython-7605936deeeb2fac75b209895717e7798f7a306f.zip
cpython-7605936deeeb2fac75b209895717e7798f7a306f.tar.gz
cpython-7605936deeeb2fac75b209895717e7798f7a306f.tar.bz2
Handle PyString_FromInternedString() failing (unlikely, but possible).
Klocwork #325 (I'm not backporting this, but if someone wants to, feel free.)
Diffstat (limited to 'Python')
-rw-r--r--Python/symtable.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 3e58b50..05d504c 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -221,8 +221,8 @@ PySymtable_Build(mod_ty mod, const char *filename, PyFutureFeatures *future)
return st;
st->st_filename = filename;
st->st_future = future;
- if (!symtable_enter_block(st, GET_IDENTIFIER(top), ModuleBlock,
- (void *)mod, 0)) {
+ if (!GET_IDENTIFIER(top) ||
+ !symtable_enter_block(st, top, ModuleBlock, (void *)mod, 0)) {
PySymtable_Free(st);
return NULL;
}
@@ -1123,12 +1123,13 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
VISIT(st, expr, e->v.UnaryOp.operand);
break;
case Lambda_kind: {
- if (!symtable_add_def(st, GET_IDENTIFIER(lambda), DEF_LOCAL))
+ if (!GET_IDENTIFIER(lambda) ||
+ !symtable_add_def(st, lambda, DEF_LOCAL))
return 0;
if (e->v.Lambda.args->defaults)
VISIT_SEQ(st, expr, e->v.Lambda.args->defaults);
/* XXX how to get line numbers for expressions */
- if (!symtable_enter_block(st, GET_IDENTIFIER(lambda),
+ if (!symtable_enter_block(st, lambda,
FunctionBlock, (void *)e, 0))
return 0;
VISIT_IN_BLOCK(st, arguments, e->v.Lambda.args, (void*)e);
@@ -1404,8 +1405,8 @@ symtable_visit_genexp(struct symtable *st, expr_ty e)
/* Outermost iterator is evaluated in current scope */
VISIT(st, expr, outermost->iter);
/* Create generator scope for the rest */
- if (!symtable_enter_block(st, GET_IDENTIFIER(genexpr),
- FunctionBlock, (void *)e, 0)) {
+ if (!GET_IDENTIFIER(genexpr) ||
+ !symtable_enter_block(st, genexpr, FunctionBlock, (void *)e, 0)) {
return 0;
}
st->st_cur->ste_generator = 1;
@@ -1419,7 +1420,5 @@ symtable_visit_genexp(struct symtable *st, expr_ty e)
VISIT_SEQ_TAIL_IN_BLOCK(st, comprehension,
e->v.GeneratorExp.generators, 1, (void*)e);
VISIT_IN_BLOCK(st, expr, e->v.GeneratorExp.elt, (void*)e);
- if (!symtable_exit_block(st, (void *)e))
- return 0;
- return 1;
+ return symtable_exit_block(st, (void *)e);
}