8000 Implement BUILD_SET for set literals eg {1,2,3} · go-python/gpython@04017d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04017d1

Browse files
committed
Implement BUILD_SET for set literals eg {1,2,3}
1 parent dd14ce9 commit 04017d1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

vm/eval.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,9 @@ func do_BUILD_TUPLE(vm *Vm, count int32) {
769769
// Works as BUILD_TUPLE, but creates a set.
770770
func do_BUILD_SET(vm *Vm, count int32) {
771771
defer vm.CheckException()
772-
vm.NotImplemented("BUILD_SET", count)
772+
set := py.NewSetFromItems(vm.frame.Stack[len(vm.frame.Stack)-int(count):])
773+
vm.DROPN(int(count))
774+
vm.PUSH(set)
773775
}
774776

775777
// Works as BUILD_TUPLE, but creates a list.

0 commit comments

Comments
 (0)
0