diff Python/symtable.c @ 35880:0d1e2e73c3ec legacy-trunk

Bring handling of genexpr in line with other anonymous scope names
author Nick Coghlan <ncoghlan@gmail.com>
date Wed, 16 Nov 2005 12:45:24 +0000
parents 79f2ce320192
children 825655bfdf20
line wrap: on
line diff
--- a/Python/symtable.c	Wed Nov 16 05:49:04 2005 +0000
+++ b/Python/symtable.c	Wed Nov 16 12:45:24 2005 +0000
@@ -170,7 +170,7 @@
 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 @@
 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;