summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2010-01-09 23:35:54 +0000
committerAlexandre Vassalotti <alexandre@peadrop.com>2010-01-09 23:35:54 +0000
commitee936a21308679654b2d458166ff094ed735fef7 (patch)
tree612cd109e8ede4080f58f30ece3212d8e0f996d2 /Python/compile.c
parente36561352895170f28f77f0b4ec4292e35d1cc01 (diff)
downloadcpython-git-ee936a21308679654b2d458166ff094ed735fef7.tar.gz
Issue #2335: Backport set literals syntax from Python 3.x.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 03875a5b38..c8cab1ce4d 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -808,6 +808,7 @@ opcode_stack_effect(int opcode, int oparg)
return 1;
case BUILD_TUPLE:
case BUILD_LIST:
+ case BUILD_SET:
return 1-oparg;
case BUILD_MAP:
return 1;
@@ -2894,6 +2895,11 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
ADDOP(c, STORE_MAP);
}
break;
+ case Set_kind:
+ n = asdl_seq_LEN(e->v.Set.elts);
+ VISIT_SEQ(c, expr, e->v.Set.elts);
+ ADDOP_I(c, BUILD_SET, n);
+ break;
case ListComp_kind:
return compiler_listcomp(c, e);
case GeneratorExp_kind: