Issue #2335: Backport set literals syntax from Python 3.x.

This commit is contained in:
Alexandre Vassalotti 2010-01-09 23:35:54 +00:00
parent e365613528
commit ee936a2130
24 changed files with 562 additions and 285 deletions

View file

@ -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: