@@ -379,7 +379,7 @@ func do_IMPORT_STAR(vm *Vm, arg int32) {
379379// Removes one block from the block stack. Per frame, there is a stack
380380// of blocks, denoting nested loops, try statements, and such.
381381func do_POP_BLOCK (vm * Vm , arg int32 ) {
382- vm .NotImplemented ( "POP_BLOCK" , arg )
382+ vm .frame . PopBlock ( )
383383}
384384
385385// Removes one block from the block stack. The popped block must be an
@@ -620,19 +620,19 @@ func do_LOAD_GLOBAL(vm *Vm, namei int32) {
620620// Pushes a block for a loop onto the block stack. The block spans
621621// from the current instruction with a size of delta bytes.
622622func do_SETUP_LOOP (vm * Vm , delta int32 ) {
623- vm .NotImplemented ( " SETUP_LOOP" , delta )
623+ vm .frame . PushBlock ( SETUP_LOOP , vm . frame . Lasti + delta , len ( vm . stack ) )
624624}
625625
626626// Pushes a try block from a try-except clause onto the block
627627// stack. delta points to the first except block.
628628func do_SETUP_EXCEPT (vm * Vm , delta int32 ) {
629- vm .NotImplemented ( " SETUP_EXCEPT" , delta )
629+ vm .frame . PushBlock ( SETUP_EXCEPT , vm . frame . Lasti + delta , len ( vm . stack ) )
630630}
631631
632632// Pushes a try block from a try-except clause onto the block
633633// stack. delta points to the finally block.
634634func do_SETUP_FINALLY (vm * Vm , delta int32 ) {
635- vm .NotImplemented ( " SETUP_FINALLY" , delta )
635+ vm .frame . PushBlock ( SETUP_FINALLY , vm . frame . Lasti + delta , len ( vm . stack ) )
636636}
637637
638638// Store a key and value pair in a dictionary. Pops the key and value
@@ -931,7 +931,7 @@ func Run(globals, locals py.StringDict, code *py.Code) (err error) {
931931 if HAS_ARG (opcode ) {
932932 arg = int32 (opcodes [frame .Lasti ])
933933 frame .Lasti ++
934- arg += int32 (opcodes [frame .Lasti ] << 8 )
934+ arg += int32 (opcodes [frame .Lasti ]) << 8
935935 frame .Lasti ++
936936 if vm .extended {
937937 arg += vm .ext << 16
0 commit comments