<s> import py <EOL> from pypy . interpreter import executioncontext <EOL> from pypy . interpreter . executioncontext import ExecutionContext <EOL> from pypy . conftest import gettestobjspace <EOL> class Finished ( Exception ) : <EOL> pass <EOL> class TestExecutionContext : <EOL> def test_action ( self ) : <EOL> class DemoAction ( executioncontext . AsyncAction ) : <EOL> counter = <NUM_LIT:0> <EOL> def perform ( self , ec , frame ) : <EOL> self . counter += <NUM_LIT:1> <EOL> if self . counter == <NUM_LIT:10> : <EOL> raise Finished <EOL> space = self . space <EOL> a1 = DemoAction ( space ) <EOL> space . actionflag . register_action ( a1 ) <EOL> for i in range ( <NUM_LIT:20> ) : <EOL> space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> try : <EOL> for i in range ( <NUM_LIT:20> ) : <EOL> a1 . fire ( ) <EOL> space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> assert a1 . counter == i + <NUM_LIT:1> <EOL> except Finished : <EOL> pass <EOL> assert i == <NUM_LIT:9> <EOL> def test_periodic_action ( self ) : <EOL> class DemoAction ( executioncontext . PeriodicAsyncAction ) : <EOL> counter = <NUM_LIT:0> <EOL> def perform ( self , ec , frame ) : <EOL> self . counter += <NUM_LIT:1> <EOL> print '<STR_LIT>' , self . counter <EOL> if self . counter == <NUM_LIT:3> : <EOL> raise Finished <EOL> space = self . space <EOL> a2 = DemoAction ( space ) <EOL> space . actionflag . register_action ( a2 ) <EOL> try : <EOL> for i in range ( <NUM_LIT> ) : <EOL> space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> except Finished : <EOL> pass <EOL> assert space . sys . checkinterval / <NUM_LIT:10> < i < space . sys . checkinterval * <NUM_LIT:3> <EOL> def test_llprofile ( self ) : <EOL> l = [ ] <EOL> def profile_func ( space , w_arg , frame , event , w_aarg ) : <EOL> assert w_arg is space . w_None <EOL> l . append ( event ) <EOL> space = self . space <EOL> space . getexecutioncontext ( ) . setllprofile ( profile_func , space . w_None ) <EOL> space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> space . getexecutioncontext ( ) . setllprofile ( None , None ) <EOL> assert l == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_llprofile_c_call ( self ) : <EOL> l = [ ] <EOL> def profile_func ( space , w_arg , frame , event , w_aarg ) : <EOL> assert w_arg is space . w_None <EOL> l . append ( event ) <EOL> space = self . space <EOL> space . getexecutioncontext ( ) . setllprofile ( profile_func , space . w_None ) <EOL> def check_snippet ( snippet ) : <EOL> space . appexec ( [ ] , """<STR_LIT>""" % snippet ) <EOL> space . getexecutioncontext ( ) . setllprofile ( None , None ) <EOL> assert l == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> check_snippet ( '<STR_LIT>' ) <EOL> check_snippet ( '<STR_LIT>' ) <EOL> check_snippet ( '<STR_LIT>' ) <EOL> check_snippet ( '<STR_LIT>' ) <EOL> check_snippet ( '<STR_LIT>' ) <EOL> check_snippet ( '<STR_LIT>' ) <EOL> def test_llprofile_c_exception ( self ) : <EOL> l = [ ] <EOL> def profile_func ( space , w_arg , frame , event , w_aarg ) : <EOL> assert w_arg is space . w_None <EOL> l . append ( event ) <EOL> space = self . space <EOL> space . getexecutioncontext ( ) . setllprofile ( profile_func , space . w_None ) <EOL> def check_snippet ( snippet ) : <EOL> space . appexec ( [ ] , """<STR_LIT>""" % snippet ) <EOL> space . getexecutioncontext ( ) . setllprofile ( None , None ) <EOL> assert l == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> check_snippet ( '<STR_LIT>' ) <EOL> def test_c_call_setprofile_outer_frame ( self ) : <EOL> space = self . space <EOL> w_events = space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> events = space . unwrap ( w_events ) <EOL> assert events == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_c_call_setprofile_strange_method ( self ) : <EOL> space = self . space <EOL> w_events = space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> events = space . unwrap ( w_events ) <EOL> assert events == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_c_call_profiles_immediately ( self ) : <EOL> space = self . space <EOL> w_events = space . appexec ( [ ] , """<STR_LIT>""" ) <EOL> events = space . unwrap ( w_events ) <EOL> assert [ i [ <NUM_LIT:0> ] for i in events ] == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> assert events [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] == events [ <NUM_LIT:1> ] [ <NUM_LIT:1> ] <EOL> def test_tracing_range_builtinshortcut ( self ) : <EOL> opts = { "<STR_LIT>" : True } <EOL> space = gettestobjspace ( ** opts ) <EOL> source = """<STR_LIT>""" <EOL> w_events = space . appexec ( [ space . wrap ( source ) ] , """<STR_LIT>""" ) <EOL> events = space . unwrap ( w_events ) <EOL> assert [ i [ <NUM_LIT:0> ] for i in events ] == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class TestFrameChaining ( object ) : <EOL> class EC ( ExecutionContext ) : <EOL> _some_frame = None <EOL> def __init__ ( self , jitted = False ) : <EOL> self . jitted = jitted <EOL> self . virtualizable = None <EOL> self . framestackdepth = <NUM_LIT:0> <EOL> self . _init_frame_chain ( ) <EOL> def _we_are_jitted ( self ) : <EOL> return self . jitted <EOL> def _get_some_frame ( self ) : <EOL> if self . _some_frame : <EOL> self . _some_frame . look_at ( ) <EOL> return self . _some_frame <EOL> def _set_some_frame ( self , frame ) : <EOL> if frame is not None : <EOL> frame . force ( ) <EOL> self . _some_frame = frame <EOL> some_frame = property ( _get_some_frame , _set_some_frame ) <EOL> class Frame ( object ) : <EOL> _f_back_some = None <EOL> _f_forward = None <EOL> def __init__ ( self , ec , virtual_with_base_frame = None ) : <EOL> self . ec = ec <EOL> self . virtual_with_base_frame = virtual_with_base_frame <EOL> self . escaped = not virtual_with_base_frame <EOL> ExecutionContext . _init_chaining_attributes ( self ) <EOL> def f_back ( self ) : <EOL> return ExecutionContext . _extract_back_from_frame ( self ) <EOL> def force_f_back ( self ) : <EOL> return ExecutionContext . _force_back_of_frame ( self ) <EOL> def force ( self ) : <EOL> if not self . escaped : <EOL> self . virtual_with_base_frame = None <EOL> self . escaped = True <EOL> if self . _f_back_some : <EOL> self . _f_back_some . force ( ) <EOL> if self . _f_forward : <EOL> self . _f_back_some . force ( ) <EOL> def look_at ( self ) : <EOL> if ( not self . ec . jitted or <EOL> self . ec . virtualizable is not self . virtual_with_base_frame ) : <EOL> self . force ( ) <EOL> def store_ref_to ( self , other ) : <EOL> if ( other . virtual_with_base_frame is not self and <EOL> other . virtual_with_base_frame is not self . virtual_with_base_frame ) : <EOL> other . force ( ) <EOL> def _get_f_back_some ( self ) : <EOL> self . look_at ( ) <EOL> return self . _f_back_some <EOL> def _set_f_back_some ( self , frame ) : <EOL> self . look_at ( ) <EOL> if frame : <EOL> frame . look_at ( ) <EOL> self . store_ref_to ( frame ) <EOL> self . _f_back_some = frame <EOL> f_back_some = property ( _get_f_back_some , _set_f_back_some ) <EOL> def _get_f_forward ( self ) : <EOL> self . look_at ( ) <EOL> return self . _f_forward <EOL> def _set_f_forward ( self , frame ) : <EOL> self . look_at ( ) <EOL> if frame : <EOL> frame . look_at ( ) <EOL> self . store_ref_to ( frame ) <EOL> self . _f_forward = frame <EOL> f_forward = property ( _get_f_forward , _set_f_forward ) <EOL> def test_f_back_no_jit ( self ) : <EOL> ec = self . EC ( ) <EOL> frame = self . Frame ( ec ) <EOL> frame2 = self . Frame ( ec ) <EOL> frame2 . f_back_some = frame <EOL> frame3 = self . Frame ( ec ) <EOL> frame3 . f_back_some = frame2 <EOL> assert frame3 . f_back ( ) is frame2 <EOL> assert frame2 . f_back ( ) is frame <EOL> assert frame . f_back ( ) is None <EOL> def test_f_back_jit ( self ) : <EOL> ec = self . EC ( ) <EOL> frame = self . Frame ( ec ) <EOL> frame2 = self . Frame ( ec ) <EOL> frame2 . f_back_some = frame <EOL> frame . f_forward = frame2 <EOL> frame3 = self . Frame ( ec ) <EOL> frame3 . f_back_some = frame <EOL> frame2 . f_forward = frame3 <EOL> assert frame3 . f_back ( ) is frame2 <EOL> assert frame2 . f_back ( ) is frame <EOL> assert frame . f_back ( ) is None <EOL> frame4 = self . Frame ( ec ) <EOL> frame4 . f_back_some = frame <EOL> assert frame4 . f_back ( ) is frame3 <EOL> def test_gettopframe_no_jit ( self ) : <EOL> ec = self . EC ( ) <EOL> frame = self . Frame ( ec ) <EOL> ec . some_frame = frame <EOL> assert ec . gettopframe ( ) is frame <EOL> def test_gettopframe_jit ( self ) : <EOL> ec = self . EC ( ) <EOL> frame = self . Frame ( ec ) <EOL> ec . some_frame = frame <EOL> assert ec . gettopframe ( ) is frame <EOL> frame2 = self . Frame ( ec ) <EOL> frame2 . f_back_some = frame <EOL> frame . f_forward = frame2 <EOL> assert ec . gettopframe ( ) is frame2 <EOL> frame3 = self . Frame ( ec ) <EOL> frame3 . f_back_some = frame <EOL> frame2 . f_forward = frame3 <EOL> assert ec . gettopframe ( ) is frame3 <EOL> frame4 = self . Frame ( ec ) <EOL> frame4 . f_back_some = frame <EOL> ec . some_frame = frame4 <EOL> assert ec . gettopframe ( ) is frame4 <EOL> def test_frame_chain ( self ) : <EOL> ec = self . EC ( ) <EOL> assert ec . some_frame is None <EOL> assert ec . framestackdepth == <NUM_LIT:0> <EOL> frame = self . Frame ( ec ) <EOL> ec . _chain ( frame ) <EOL> assert ec . some_frame is frame <EOL> assert ec . framestackdepth == <NUM_LIT:1> <EOL> assert frame . f_back_some is None <EOL> assert frame . f_forward is None <EOL> assert ec . gettopframe ( ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> frame2 = self . Frame ( ec ) <EOL> ec . _chain ( frame2 ) <EOL> assert ec . some_frame is frame2 <EOL> assert ec . framestackdepth == <NUM_LIT:2> <EOL> assert frame2 . f_back_some is frame <EOL> assert frame . f_forward is None <EOL> assert frame2 . f_forward is None <EOL> assert ec . gettopframe ( ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> frame3 = self . Frame ( ec ) <EOL> ec . _chain ( frame3 ) <EOL> assert ec . some_frame is frame3 <EOL> assert frame3 . f_back_some is frame2 <EOL> assert frame2 . f_forward is None <EOL> assert ec . gettopframe ( ) is frame3 <EOL> assert ec . _extract_back_from_frame ( frame3 ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert ec . some_frame is frame2 <EOL> assert ec . framestackdepth == <NUM_LIT:2> <EOL> assert frame2 . f_forward is None <EOL> assert frame3 . f_back_some is frame2 <EOL> assert ec . gettopframe ( ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame2 . f_back ( ) is frame <EOL> ec . _unchain ( frame2 ) <EOL> assert ec . some_frame is frame <EOL> assert ec . framestackdepth == <NUM_LIT:1> <EOL> assert frame . f_forward is None <EOL> assert frame2 . f_back_some is frame <EOL> assert ec . gettopframe ( ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame . f_back ( ) is None <EOL> ec . _unchain ( frame ) <EOL> assert ec . some_frame is None <EOL> assert ec . framestackdepth == <NUM_LIT:0> <EOL> assert frame . f_back_some is None <EOL> assert ec . gettopframe ( ) is None <EOL> def test_frame_chain_forced ( self ) : <EOL> ec = self . EC ( ) <EOL> frame = self . Frame ( ec ) <EOL> ec . _chain ( frame ) <EOL> assert ec . gettopframe ( ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> frame2 = self . Frame ( ec ) <EOL> ec . _chain ( frame2 ) <EOL> assert ec . some_frame is frame2 <EOL> assert ec . framestackdepth == <NUM_LIT:2> <EOL> assert frame2 . f_back_some is frame <EOL> assert frame . f_forward is None <EOL> assert frame2 . f_forward is None <EOL> res = frame2 . force_f_back ( ) <EOL> assert res is frame <EOL> assert frame . f_back_forced <EOL> assert ec . gettopframe ( ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> frame3 = self . Frame ( ec ) <EOL> ec . _chain ( frame3 ) <EOL> assert ec . gettopframe ( ) is frame3 <EOL> assert ec . _extract_back_from_frame ( frame3 ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert ec . some_frame is frame2 <EOL> assert frame3 . f_back_some is frame2 <EOL> assert ec . gettopframe ( ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame2 . f_back ( ) is frame <EOL> ec . _unchain ( frame2 ) <EOL> assert frame2 . f_back_some is frame <EOL> assert ec . gettopframe ( ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame . f_back ( ) is None <EOL> ec . _unchain ( frame ) <EOL> assert ec . some_frame is None <EOL> assert frame . f_back_some is None <EOL> assert frame2 . f_back ( ) is frame <EOL> assert frame . f_back ( ) is None <EOL> assert ec . gettopframe ( ) is None <EOL> def test_frame_chain_jitted ( self ) : <EOL> ec = self . EC ( ) <EOL> assert ec . some_frame is None <EOL> assert ec . framestackdepth == <NUM_LIT:0> <EOL> assert ec . gettopframe ( ) is None <EOL> frame = self . Frame ( ec ) <EOL> ec . _chain ( frame ) <EOL> assert ec . some_frame is frame <EOL> assert ec . framestackdepth == <NUM_LIT:1> <EOL> assert frame . f_back_some is None <EOL> assert frame . f_forward is None <EOL> assert ec . gettopframe ( ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> ec . jitted = True <EOL> ec . virtualizable = frame <EOL> frame2 = self . Frame ( ec , frame ) <EOL> ec . _chain ( frame2 ) <EOL> assert ec . some_frame is frame <EOL> assert ec . framestackdepth == <NUM_LIT:2> <EOL> assert frame2 . f_back_some is frame <EOL> assert frame . f_forward is frame2 <EOL> assert frame2 . f_forward is None <EOL> assert ec . gettopframe ( ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> frame3 = self . Frame ( ec , frame ) <EOL> ec . _chain ( frame3 ) <EOL> assert ec . some_frame is frame <EOL> assert frame3 . f_back_some is frame <EOL> assert frame2 . f_forward is frame3 <EOL> assert ec . gettopframe ( ) is frame3 <EOL> assert ec . _extract_back_from_frame ( frame3 ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert ec . some_frame is frame <EOL> assert ec . framestackdepth == <NUM_LIT:2> <EOL> assert frame2 . f_forward is None <EOL> assert frame3 . f_back_some is frame <EOL> assert not frame3 . escaped <EOL> assert not frame2 . escaped <EOL> assert ec . gettopframe ( ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> ec . jitted = False <EOL> ec . virtualizable = None <EOL> ec . _chain ( frame3 ) <EOL> assert not frame2 . escaped <EOL> assert ec . some_frame is frame3 <EOL> assert frame3 . f_back_some is frame <EOL> assert frame2 . f_forward is None <EOL> assert frame3 . escaped <EOL> assert ec . gettopframe ( ) is frame3 <EOL> assert ec . _extract_back_from_frame ( frame3 ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert ec . some_frame is frame <EOL> assert ec . framestackdepth == <NUM_LIT:2> <EOL> assert frame2 . f_forward is None <EOL> assert frame3 . f_back_some is frame <EOL> assert ec . gettopframe ( ) is frame2 <EOL> assert ec . _extract_back_from_frame ( frame2 ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> ec . jitted = True <EOL> ec . virtualizable = frame <EOL> assert frame2 . f_back ( ) is frame <EOL> ec . _unchain ( frame2 ) <EOL> assert ec . some_frame is frame <EOL> assert ec . framestackdepth == <NUM_LIT:1> <EOL> assert frame . f_forward is None <EOL> assert frame2 . f_back_some is frame <EOL> assert ec . gettopframe ( ) is frame <EOL> assert ec . _extract_back_from_frame ( frame ) is None <EOL> ec . jitted = False <EOL> assert frame . f_back ( ) is None <EOL> ec . _unchain ( frame ) <EOL> assert ec . some_frame is None <EOL> assert ec . framestackdepth == <NUM_LIT:0> <EOL> assert frame . f_back_some is None <EOL> assert ec . gettopframe ( ) is None <EOL> def test_frame_chain_jitted_forced ( self ) : <EOL> ec = self . EC ( ) <EOL> assert ec . some_frame is None <EOL> assert ec . framestackdepth == <NUM_LIT:0> <EOL> frame = self . Frame ( ec ) <EOL> ec . _chain ( frame ) <EOL> ec . jitted = True <EOL> frame2 = self . Frame ( ec ) <EOL> ec . _chain ( frame2 ) <EOL> frame3 = self . Frame ( ec ) <EOL> ec . _chain ( frame3 ) <EOL> res = frame3 . force_f_back ( ) <EOL> assert res is frame2 <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert frame2 . f_back ( ) is frame <EOL> ec . _unchain ( frame2 ) <EOL> ec . jitted = False <EOL> assert frame . f_back ( ) is None <EOL> ec . _unchain ( frame ) <EOL> assert frame3 . f_back ( ) is frame2 <EOL> assert frame2 . f_back ( ) is frame <EOL> assert frame . f_back ( ) is None <EOL> def enter_two_jitted_levels ( self ) : <EOL> ec = self . EC ( ) <EOL> assert ec . some_frame is None <EOL> assert ec . framestackdepth == <NUM_LIT:0> <EOL> frame = self . Frame ( ec ) <EOL> ec . _chain ( frame ) <EOL> ec . jitted = True <EOL> ec . virtualizable = frame <EOL> frame2 = self . Frame ( ec , frame ) <EOL> ec . _chain ( frame2 ) <EOL> assert not frame2 . escaped <EOL> return ec , frame , frame2 <EOL> def leave_two_jitted_levels ( self , ec , frame , frame2 ) : <EOL> assert frame2 . f_back ( ) is frame <EOL> ec . _unchain ( frame2 ) <EOL> ec . jitted = False <EOL> assert frame . f_back ( ) is None <EOL> ec . _unchain ( frame ) <EOL> def test_check_escaping_all_inlined ( self ) : <EOL> ec , frame , frame2 = self . enter_two_jitted_levels ( ) <EOL> frame3 = self . Frame ( ec , frame ) <EOL> ec . _chain ( frame3 ) <EOL> assert not frame2 . escaped <EOL> assert not frame3 . escaped <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert not frame2 . escaped <EOL> self . leave_two_jitted_levels ( ec , frame , frame2 ) <EOL> def test_check_escaping_not_all_inlined_enter_leave_not_seen ( self ) : <EOL> ec , frame , frame2 = self . enter_two_jitted_levels ( ) <EOL> ec . jitted = False <EOL> frame3 = self . Frame ( ec ) <EOL> ec . _chain ( frame3 ) <EOL> assert not frame2 . escaped <EOL> assert frame3 . escaped <EOL> ec . _unchain ( frame3 ) <EOL> ec . jitted = True <EOL> assert not frame2 . escaped <EOL> self . leave_two_jitted_levels ( ec , frame , frame2 ) <EOL> def test_check_escaping_not_all_inlined_enter_leave_seen ( self ) : <EOL> ec , frame , frame2 = self . enter_two_jitted_levels ( ) <EOL> frame3 = self . Frame ( ec , frame ) <EOL> ec . _chain ( frame3 ) <EOL> ExecutionContext . _jit_rechain_frame ( ec , frame3 ) <EOL> ec . jitted = False <EOL> frame3 . look_at ( ) <EOL> assert not frame2 . escaped <EOL> assert frame3 . escaped <EOL> ec . jitted = True <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert not frame2 . escaped <EOL> self . leave_two_jitted_levels ( ec , frame , frame2 ) <EOL> def test_check_escaping_multi_non_jitted_levels ( self ) : <EOL> ec , frame , frame2 = self . enter_two_jitted_levels ( ) <EOL> frame3 = self . Frame ( ec , frame ) <EOL> ec . _chain ( frame3 ) <EOL> ExecutionContext . _jit_rechain_frame ( ec , frame3 ) <EOL> ec . jitted = False <EOL> assert frame3 . escaped <EOL> assert not frame2 . escaped <EOL> assert frame3 . escaped <EOL> frame4 = self . Frame ( ec ) <EOL> ec . _chain ( frame4 ) <EOL> assert ec . framestackdepth == <NUM_LIT:4> <EOL> ec . _unchain ( frame4 ) <EOL> assert frame3 . escaped <EOL> assert not frame2 . escaped <EOL> ec . jitted = True <EOL> assert frame3 . f_back ( ) is frame2 <EOL> ec . _unchain ( frame3 ) <EOL> assert not frame2 . escaped <EOL> self . leave_two_jitted_levels ( ec , frame , frame2 ) <EOL> def test_check_escaping_jitted_with_two_differen_virtualizables ( self ) : <EOL> ec , frame , frame2 = self . enter_two_jitted_levels ( ) <EOL> frame3 = self . Frame ( ec , frame ) <EOL> ec . _chain ( frame3 ) <EOL> ExecutionContext . _jit_rechain_frame ( ec , frame3 ) <EOL> ec . virtualizable = frame3 <EOL> frame3 . look_at ( ) <EOL> assert not frame2 . escaped <EOL> assert frame3 . escaped <EOL> frame4 = self . Frame ( ec , frame3 ) <EOL> ec . _chain ( frame4 ) <EOL> assert ec . framestackdepth == <NUM_LIT:4> <EOL> assert not frame4 . escaped <EOL> ec . _unchain ( frame4 ) <EOL> assert frame3 . escaped <EOL> assert not frame2 . escaped <EOL> ec . virtualizable = frame <EOL> ec . _unchain ( frame3 ) <EOL> assert not frame2 . escaped </s>
