summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-02-17 05:30:26 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-02-17 05:30:26 (GMT)
commit3081421d9e7456f4c3078ec40ee445751c5c5a07 (patch)
treecad420f833fed34895bd40706c4ede74dea73bc3 /Python/compile.c
parent27eba5e88810e433633e0028cc68e74619ace377 (diff)
downloadcpython-3081421d9e7456f4c3078ec40ee445751c5c5a07.zip
cpython-3081421d9e7456f4c3078ec40ee445751c5c5a07.tar.gz
cpython-3081421d9e7456f4c3078ec40ee445751c5c5a07.tar.bz2
Change temp names created by listcomps from [%d] to _[%d], so the one-liner
[k for k in dir() if k[0] != "_"] can be used to get the non-private names (used to contain "[1]").
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 916c4a6..c562def 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1309,7 +1309,7 @@ com_list_comprehension(struct compiling *c, node *n)
{
/* listmaker: test list_for */
char tmpname[12];
- sprintf(tmpname, "[%d]", ++c->c_tmpname);
+ sprintf(tmpname, "_[%d]", ++c->c_tmpname);
com_addoparg(c, BUILD_LIST, 0);
com_addbyte(c, DUP_TOP); /* leave the result on the stack */
com_push(c, 2);
@@ -4689,7 +4689,7 @@ symtable_list_comprehension(struct symtable *st, node *n)
{
char tmpname[12];
- sprintf(tmpname, "[%d]", ++st->st_tmpname);
+ sprintf(tmpname, "_[%d]", ++st->st_tmpname);
symtable_add_def(st, tmpname, DEF_LOCAL);
symtable_assign(st, CHILD(n, 1), 0);
symtable_node(st, CHILD(n, 3));