@@ -610,46 +610,6 @@ def byte_POP_EXCEPT(self):
610610 raise Exception ("popped block is not an except handler" )
611611 self .unwind_except_handler (block )
612612
613- def byte_SETUP_WITH (self , dest ):
614- ctxmgr = self .pop ()
615- self .push (ctxmgr .__exit__ )
616- ctxmgr_obj = ctxmgr .__enter__ ()
617- self .push_block ('finally' , dest )
618- self .push (ctxmgr_obj )
619-
620- def byte_WITH_CLEANUP (self ):
621- # The code here does some weird stack manipulation: the exit function
622- # is buried in the stack, and where depends on what's on top of it.
623- # Pull out the exit function, and leave the rest in place.
624- v = w = None
625- u = self .top ()
626- if u is None : # same in 2/3
627- exit_func = self .pop (1 )
628- elif isinstance (u , str ): # same in 2/3
629- if u in ('return' , 'continue' ):
630- exit_func = self .pop (2 )
631- else :
632- exit_func = self .pop (1 )
633- u = None
634- elif issubclass (u , BaseException ):
635- w , v , u = self .popn (3 )
636- tp , exc , tb = self .popn (3 )
637- exit_func = self .pop ()
638- self .push (tp , exc , tb )
639- self .push (None )
640- self .push (w , v , u )
641- block = self .pop_block ()
642- assert block .type == 'except-handler'
643- self .push_block (block .type , block .handler , block .level - 1 )
644-
645- else : # pragma: no cover
646- raise VirtualMachineError ("Confused WITH_CLEANUP" )
647- exit_ret = exit_func (u , v , w )
648- err = (u is not None ) and bool (exit_ret )
649- if err :
650- # An error occurred, and was suppressed
651- self .push ('silenced' )
652-
653613 ## Functions
654614
655615 def byte_MAKE_FUNCTION (self , argc ):
0 commit comments