@@ -33,8 +33,9 @@ objects so they can be GCed
33
33
34
34
import (
35
35
// "fmt"
36
- "github.com/ncw/gpython/py"
37
36
"runtime/debug"
37
+
38
+ "github.com/ncw/gpython/py"
38
39
)
39
40
40
41
const (
@@ -536,7 +537,9 @@ func do_UNPACK_EX(vm *Vm, counts int32) {
536
537
// Calls set.add(TOS1[-i], TOS). Used to implement set comprehensions.
537
538
func do_SET_ADD (vm * Vm , i int32 ) {
538
539
defer vm .CheckException ()
539
- vm .NotImplemented ("SET_ADD" , i )
540
+ w := vm .POP ()
541
+ v := vm .PEEK (int (i ))
542
+ v .(* py.Set ).Add (w )
540
543
}
541
544
542
545
// Calls list.append(TOS[-i], TOS). Used to implement list
@@ -553,7 +556,13 @@ func do_LIST_APPEND(vm *Vm, i int32) {
553
556
// Calls dict.setitem(TOS1[-i], TOS, TOS1). Used to implement dict comprehensions.
554
557
func do_MAP_ADD (vm * Vm , i int32 ) {
555
558
defer vm .CheckException ()
556
- vm .NotImplemented ("MAP_ADD" , i )
559
+ key := vm .TOP ()
560
+ value := vm .SECOND ()
561
+ vm .DROPN (2 )
562
+ dict := vm .PEEK (int (i ))
563
+ // FIXME assert(PyDict_CheckExact(dict));
564
+ // err = PyDict_SetItem(map, key, value); /* v[w] = u */
565
+ py .SetItem (dict , key , value )
557
566
}
558
567
559
568
// Returns with TOS to the caller of the function.
0 commit comments