summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2005-11-16 12:45:24 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2005-11-16 12:45:24 (GMT)
commit99b2533539dbc98fe7e5b3ac95e71879afca1c2c (patch)
treec4dfa4c50c39044b24c4d0680eed52eb1f691f14
parenta3fd07d524dc37d7f3b2b0d1e6086109547b2ba6 (diff)
downloadcpython-99b2533539dbc98fe7e5b3ac95e71879afca1c2c.zip
cpython-99b2533539dbc98fe7e5b3ac95e71879afca1c2c.tar.gz
cpython-99b2533539dbc98fe7e5b3ac95e71879afca1c2c.tar.bz2
Bring handling of genexpr in line with other anonymous scope names
-rw-r--r--Python/symtable.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 2681cbd..fad7cec 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -170,7 +170,7 @@ static int symtable_visit_params_nested(struct symtable *st, asdl_seq *args);
static int symtable_implicit_arg(struct symtable *st, int pos);
-static identifier top = NULL, lambda = NULL;
+static identifier top = NULL, lambda = NULL, genexpr = NULL;
#define GET_IDENTIFIER(VAR) \
((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR)))
@@ -1329,14 +1329,13 @@ symtable_visit_slice(struct symtable *st, slice_ty s)
static int
symtable_visit_genexp(struct symtable *st, expr_ty e)
{
- identifier tmp;
comprehension_ty outermost = ((comprehension_ty)
(asdl_seq_GET(e->v.GeneratorExp.generators, 0)));
/* Outermost iterator is evaluated in current scope */
VISIT(st, expr, outermost->iter);
/* Create generator scope for the rest */
- tmp = PyString_FromString("<genexpr>");
- if (!symtable_enter_block(st, tmp, FunctionBlock, (void *)e, 0)) {
+ if (!symtable_enter_block(st, GET_IDENTIFIER(genexpr),
+ FunctionBlock, (void *)e, 0)) {
return 0;
}
st->st_cur->ste_generator = 1;