diff Python/compile.c @ 58229:c2fdf25329ff legacy-trunk

Issue #2335: Backport set literals syntax from Python 3.x.
author Alexandre Vassalotti <alexandre@peadrop.com>
date Sat, 09 Jan 2010 23:35:54 +0000
parents e06c3f62fcc9
children edfed0e32ced
line wrap: on
line diff
--- a/Python/compile.c	Sat Jan 09 18:50:50 2010 +0000
+++ b/Python/compile.c	Sat Jan 09 23:35:54 2010 +0000
@@ -808,6 +808,7 @@
 			return 1;
 		case BUILD_TUPLE:
 		case BUILD_LIST:
+		case BUILD_SET:
 			return 1-oparg;
 		case BUILD_MAP:
 			return 1;
@@ -2894,6 +2895,11 @@
 			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: