Skip to content

Commit 99b2533

Browse files
committed
Bring handling of genexpr in line with other anonymous scope names
1 parent a3fd07d commit 99b2533

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Python/symtable.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static int symtable_visit_params_nested(struct symtable *st, asdl_seq *args);
170170
static int symtable_implicit_arg(struct symtable *st, int pos);
171171

172172

173-
static identifier top = NULL, lambda = NULL;
173+
static identifier top = NULL, lambda = NULL, genexpr = NULL;
174174

175175
#define GET_IDENTIFIER(VAR) \
176176
((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR)))
@@ -1329,14 +1329,13 @@ symtable_visit_slice(struct symtable *st, slice_ty s)
13291329
static int
13301330
symtable_visit_genexp(struct symtable *st, expr_ty e)
13311331
{
1332-
identifier tmp;
13331332
comprehension_ty outermost = ((comprehension_ty)
13341333
(asdl_seq_GET(e->v.GeneratorExp.generators, 0)));
13351334
/* Outermost iterator is evaluated in current scope */
13361335
VISIT(st, expr, outermost->iter);
13371336
/* Create generator scope for the rest */
1338-
tmp = PyString_FromString("<genexpr>");
1339-
if (!symtable_enter_block(st, tmp, FunctionBlock, (void *)e, 0)) {
1337+
if (!symtable_enter_block(st, GET_IDENTIFIER(genexpr),
1338+
FunctionBlock, (void *)e, 0)) {
13401339
return 0;
13411340
}
13421341
st->st_cur->ste_generator = 1;

0 commit comments

Comments
 (0)