
    daf;R                    
   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlZd dl	m
Z
 d dlZd dlZ ej                  d        G d d      Z G d	 d
      Zd Zd Zd Zg de_        d Zg de_        d Zg de_        d Zg de_        d Zg de_        d Zg de_        d Zg de_        d Zd Zg de_        d Zd Zg de_        d  Zd! Zd"ge_        d# Z d$ Z!g d%e!_        d& Z"g d'e"_        d( Z#g d)e#_        d* Z$g d+e$_        d, Z%d- Z&g d.d/d0gd1z  z   d/d2gz   e&_         G d3 d4      Z' G d5 d6ejP                        Z)g d7Z* G d8 d9e)      Z+ejX                   G d: d;e)             Z- G d< d=ejP                        Z. G d> d?      Z/d@ Z0dA Z1 G dB dCejP                        Z2 G dD dEejP                        Z3 G dF dGejP                        Z4 G dH dIe)      Z5 G dJ dKe)      Z6e7dLk(  r ejp                          yy)M    )supportNwraps)import_helperT)modulec                   "    e Zd ZdZd Zd Zd Zy)tracecontextz/Context manager that traces its enter and exit.c                      || _         || _        y Noutputvalueselfr   r   s      1/root/Python-3.12.4/Lib/test/test_sys_settrace.py__init__ztracecontext.__init__       
    c                 N    | j                   j                  | j                         y r   r   appendr   r   s    r   	__enter__ztracecontext.__enter__   s    4::&r   c                 P    | j                   j                  | j                          y r   r   r   exc_infos     r   __exit__ztracecontext.__exit__   s    DJJ;'r   N)__name__
__module____qualname____doc__r   r   r    r   r   r	   r	      s    9'(r   r	   c                   "    e Zd ZdZd Zd Zd Zy)asynctracecontextz>Asynchronous context manager that traces its aenter and aexit.c                      || _         || _        y r   r   r   s      r   r   zasynctracecontext.__init__   r   r   c                 V   K   | j                   j                  | j                         y wr   r   r   s    r   
__aenter__zasynctracecontext.__aenter__"   s     4::&s   ')c                 X   K   | j                   j                  | j                          y wr   r   r   s     r   	__aexit__zasynctracecontext.__aexit__%   s     DJJ;'s   (*N)r   r   r    r!   r   r'   r)   r"   r   r   r$   r$      s    H'(r   r$   c                $   K   | D ]  }| 	 yw)z0Convert an iterable to an asynchronous iterator.Nr"   )iterablexs     r   	asynciterr-   (   s      s   c                 .     t                fd       }|S )Nc                     K   g fd}	  | i |d|i d {   r! j                                 d {    r S S 7 '7 # r" j                                 d {  7   r!w w xY ww)Nc                 T    t        |       }j                  |j                         |S r   )r-   r   aclose)r+   itcleanupss     r   wrapped_asynciterz;clean_asynciter.<locals>.wrapper.<locals>.wrapped_asynciter1   s"    8$BOOBII&Ir   r-   pop)argskwargsr4   r3   tests      @r   wrapperz clean_asynciter.<locals>.wrapper.   ss     		'tKvK9JKK$hlln&&&  L ' $hlln&&& sS   A1A AA A1AA1A1A A1A.#A&$A.,A..A1r   )r9   r:   s   ` r   clean_asynciterr;   -   s     
4[
' 
' Nr   c                       yN   r"   r"   r   r   basicr?   =   s    r   )r   callr>   liner>   returnc                      d} ~ 	 d} y r=   r"   r,   s    r   arigo_example0rH   L   s    	A	
	Ar   )r@   rB      rC      rC      rC   rN   rE   c                      d} ~ 	 d} y r=   r"   rG   s    r   arigo_example1rQ   Z   s    	A		Ar   c                      d} ~ 	 d} y r=   r"   rG   s    r   arigo_example2rS   h   s    	A	 r   )r@   rB   rI   rK      rC      rC   rW   rE   c                      d} ~ d} y r=   r"   rG   s    r   one_instr_linerZ   {   s    	A		Ar   r@   rB   rI   rK   rL   rE   c                  6    d} t        d      D ]	  }|rd} d}  y Nr>   rJ   range)r,   as     r   no_pop_topsrb      s'    	A1X AA	r   )
r@   rB   rI   rK      rC   rI   rK   rT   rI   rJ   rE   c                  "    d} | s	t          | s	d}y r=   )bla)yr,   s     r   no_pop_blocksri      s    	A 	Ar   r@   rB   rI   rT   rU   rE   c                      d} y r=   r"   rG   s    r   calledrm      s    	Ar   c                      t                y r   )rm   r"   r   r   rA   rA      s    
Hr   )r@   rB   rA   rC   rr   rE   rD   c                      t         r   	Exceptionr"   r   r   raisesrw      s    
Or   c                  8    	 t                y # t        $ r Y y w xY wr   )rw   rv   r"   r   r   
test_raisery      s     s   
 	)r@   rB   rI   ro   rq   rr   	exceptionrs   rJ   r{   rK   rT   rk   c                 t    t        j                  |        | t        j                         j                  _        y r   )syssettrace	_getframef_backf_trace	tracefuncs    r   _settrace_and_returnr      s"    LL%.CMMO"r   c                     t        |        y r   )r   r   s    r   settrace_and_returnr      s
    #r   rD   c                 ~    t        j                  |        | t        j                         j                  _        t
        r   )r~   r   r   r   r   RuntimeErrorr   s    r   _settrace_and_raiser      s(    LL%.CMMO"
r   c                 :    	 t        |        y # t        $ r Y y w xY wr   )r   r   r   s    r   settrace_and_raiser      s!    I& s    	)r|   rK   rT   rk   c                  "    d} d}| |k(  r| dz   }y y )NrN   r>   r"   )ra   bs     r   ireturn_exampler      s    	A	AAvaCr   r@   rB   rI   rK   rT   rk   c                  V    t        dd      } 	 d}	 | |   }|dz  }# t        $ r Y y w xY w)Nr   rL   r>   r`   
IndexError)itemsir   s      r   tightloop_exampler      sB    !QKEaA!Q$!  s    	(()r@   rB   rI   rK   rT   rM   rT   rM   rT   rM   rT   rM   )rN   r{   rc   rV   rX   c                  J    t        dd      } 	 d}| |   }# t        $ r Y y w xY w)Nr>   rU   r   r   )r   r   s     r   tighterloop_exampler     s4    !QKE1Xa s    	"")r@   rB   rI   rK   rT   rT   rT   rT   )rU   r{   rM   rc   rd   rE   c               #   "   K   	 d 	 y # w xY wwNTr"   r"   r   r   generator_functionr   %  s     
	s   
 c                  N    t        t                     } t        d      D ]  } | } y )N
   )anyr   r`   )r,   rh   s     r   generator_exampler   +  s*     !A 2Y r   )
r@   rI   rA   rC   rC   r   rE   )r   rA   r   r{   rC   r   rE   rM   rc   r   rO   c                   &    e Zd ZddZd Zd Zd Zy)TracerNc                 .    || _         || _        g | _        y r   )trace_line_eventstrace_opcode_eventsevents)r   r   r   s      r   r   zTracer.__init__B  s    !2#6 r   c                 z    | j                   | j                   |_        | j                  | j                  |_        y y r   )r   f_trace_linesr   f_trace_opcodes)r   frames     r   _reconfigure_framezTracer._reconfigure_frameG  s;    !!-"&"8"8E##/$($<$<E! 0r   c                     | j                  |       | j                  j                  |j                  |f       | j                  S r   r   r   r   f_linenotracer   r   eventargs       r   r   zTracer.traceM  s5    &ENNE23zzr   c                     | j                  |       d dD         | j                  j                  |j                  |f       | j                  S )Nc              3       K   | ]  }|  y wr   r"   ).0os     r   	<genexpr>z)Tracer.traceWithGenexp.<locals>.<genexpr>T  s     qs   r>   r   r   s       r   traceWithGenexpzTracer.traceWithGenexpR  s=    &CENNE23zzr   )NN)r   r   r    r   r   r   r   r"   r   r   r   r   A  s    
=
r   r   c                      e Zd Zd Zd Zed        Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d  Z#d! Z$d" Z%d# Z&d$ Z'd% Z(d& Z)d' Z*d( Z+d) Z,d* Z-d+ Z.d, Z/d- Z0d. Z1d/ Z2d0 Z3d1 Z4d2 Z5d3 Z6d4 Z7d5 Z8d6 Z9d7 Z:d8 Z;d9 Z<d: Z=d; Z>d< Z?d= Z@d> ZAd? ZBd@ ZCdA ZDdB ZEdC ZFdD ZGdE ZHeIj                  dF        ZKdG ZLeIj                  dH        ZMdI ZNyJ)KTraceTestCasec                     t        j                         | _        t        j                          | j	                  t
        j                  t        j                                y r   )gc	isenabledusing_gcdisable
addCleanupr~   r   gettracer   s    r   setUpzTraceTestCase.setUp]  s0    


clln5r   c                 F    | j                   rt        j                          y y r   )r   r   enabler   s    r   tearDownzTraceTestCase.tearDownb  s    ==IIK r   c                      t               S )z@Helper to allow test subclasses to configure tracers differentlyr   r"   r   r   make_tracerzTraceTestCase.make_tracerf  s     xr   c                 4   |D cg c]  \  }}|||z
  nd |f }}}||k7  rf| j                  ddj                  t        j                  |D cg c]  }t	        |       c}|D cg c]  }t	        |       c}            z          y y c c}}w c c}w c c}w )Nz"events did not match expectation:

)failjoindifflibndiffstr)r   line_offsetr   expected_eventsler,   s          r   compare_eventszTraceTestCase.compare_eventsk  s    PVWfq!am1{?qAWW_$II5		'--(IAQ(I9?(@AQ(@B CCD % X )J(@s   B
B%Bc                     | j                         }t        j                  |j                          |        t        j                  d        | j	                  |j
                  j                  |j                  |       y r   )r   r~   r   r   r   __code__co_firstlinenor   )r   funcr   tracers       r   run_and_comparezTraceTestCase.run_and_compares  sT    !!#V\\"TDMM88"MM6	3r   c                 <    | j                  ||j                         y r   )r   r   r   r   s     r   run_testzTraceTestCase.run_test{  s    T4;;/r   c                     | j                         } ||j                         t        j                  d        | j	                  |j
                  j                  |j                  |j                         y r   )r   r   r~   r   r   r   r   r   )r   r   r   s      r   	run_test2zTraceTestCase.run_test2~  sO    !!#V\\TDMM88"MM4;;	8r   c                 Z    t        j                  d        t        j                         J y r   r~   r   r   r   s    r   test_set_and_retrieve_nonez(TraceTestCase.test_set_and_retrieve_none  s     T||~%%%r   c                     d }t        j                  |       	 t        j                         |u sJ 	 t        j                  d        y # t        j                  d        w xY w)Nc                       y r   r"   r7   s    r   fnz4TraceTestCase.test_set_and_retrieve_func.<locals>.fn      r   r   )r   r   s     r   test_set_and_retrieve_funcz(TraceTestCase.test_set_and_retrieve_func  sG    	 	R	<<>R'''LLCLLs   A	 	A c                 .    | j                  t               y r   )r   r?   r   s    r   test_01_basiczTraceTestCase.test_01_basic  s    er   c                 .    | j                  t               y r   )r   rH   r   s    r   test_02_arigo0zTraceTestCase.test_02_arigo0      n%r   c                 .    | j                  t               y r   )r   rQ   r   s    r   test_02_arigo1zTraceTestCase.test_02_arigo1  r   r   c                 .    | j                  t               y r   )r   rS   r   s    r   test_02_arigo2zTraceTestCase.test_02_arigo2  r   r   c                 .    | j                  t               y r   )r   rZ   r   s    r   test_03_one_instrzTraceTestCase.test_03_one_instr  r   r   c                 .    | j                  t               y r   )r   ri   r   s    r   test_04_no_pop_blocksz#TraceTestCase.test_04_no_pop_blocks  s    m$r   c                 .    | j                  t               y r   )r   rb   r   s    r   test_05_no_pop_topsz!TraceTestCase.test_05_no_pop_tops  s    k"r   c                 .    | j                  t               y r   )r   rA   r   s    r   test_06_callzTraceTestCase.test_06_call  s    dr   c                 .    | j                  t               y r   )r   ry   r   s    r   test_07_raisezTraceTestCase.test_07_raise  s    j!r   c                 .    | j                  t               y r   )r   r   r   s    r   test_08_settrace_and_returnz)TraceTestCase.test_08_settrace_and_return  s    *+r   c                 .    | j                  t               y r   )r   r   r   s    r   test_09_settrace_and_raisez(TraceTestCase.test_09_settrace_and_raise  s    )*r   c                 .    | j                  t               y r   )r   r   r   s    r   test_10_ireturnzTraceTestCase.test_10_ireturn  s    o&r   c                 .    | j                  t               y r   )r   r   r   s    r   test_11_tightloopzTraceTestCase.test_11_tightloop  s    '(r   c                 .    | j                  t               y r   )r   r   r   s    r   test_12_tighterloopz!TraceTestCase.test_12_tighterloop  s    )*r   c                 P   | j                  t               | j                         }t        j                  |j
                         t                t        j                  d        | j                  t        j                  j                  |j                  t        j                         y r   )
r   r   r   r~   r   r   r   r   r   r   )r   r   s     r   test_13_genexpzTraceTestCase.test_13_genexp  sq    '(
 !!#V++,T-66EE"MM+<+C+C	Er   c                 2    d }| j                  |g d       y )Nc                      d} y)NFr   r"   rG   s    r   onlinersz2TraceTestCase.test_14_onliner_if.<locals>.onliners  s
    Qr   )r@   rB   rK   r\   r   )r   r  s     r   test_14_onliner_ifz TraceTestCase.test_14_onliner_if  s    	 		r   c                 `    d }| j                  |g d       d }| j                  |g d       y )Nc                  $    t        d      D ]  }  y NrJ   r_   rG   s    r   for_examplez0TraceTestCase.test_15_loops.<locals>.for_example  s    1X r   )r@   rB   rI   rB   rI   rB   rD   c                  *    d} | dkD  r| dz  } | dkD  ry y )NrJ   r   r>   r"   rG   s    r   while_examplez2TraceTestCase.test_15_loops.<locals>.while_example  s     Aa%Q a%r   )r@   rI   rK   rT   rK   rT   rK   r\   r  )r   r  r  s      r   test_15_loopszTraceTestCase.test_15_loops  s<    	 			
 			r   c                 N    i }t        d|       | j                  |d   g d       y )Na  def f():
































































































































































































































































    passf)r@   )  rC   )r"  rE   execr   )r   	namespaces     r   test_16_blank_linesz!TraceTestCase.test_16_blank_lines  s,    	3Y?cN	r   c                 2    d }| j                  |ddg       y )Nc                  :    d t        j                         _        d} y r  )r~   r   r   )linenos    r   r   z0TraceTestCase.test_17_none_f_trace.<locals>.func  s    &*CMMO#Fr   r@   rB   r  r   s     r   test_17_none_f_tracez"TraceTestCase.test_17_none_f_trace  s$    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  T    	 	 t         # t         $ r}  d } ~ ww xY w# t         $ r Y y w xY wr   ru   )r   r,   rh   s      r   r   z4TraceTestCase.test_18_except_with_name.<locals>.func  s7    $#O  $$  s   	 	 	'')
r@   rB   rI   rK   rL   r{   rT   rM      rC   	   rC   )r1  rE   r  r   s     r   test_18_except_with_namez&TraceTestCase.test_18_except_with_name  s    		 	T	
	r   c                 2    d }| j                  |g d       y )Nc                  B    	 	 t         # d} w xY w# t         $ r d}Y y w xY w)N	Something   ru   )rh   r   s     r   r   z7TraceTestCase.test_19_except_with_finally.<locals>.func  s+    $#O#A s   	  )	r@   rB   rI   rK   r-  rM   rc   rV   rX   r  r   s     r   test_19_except_with_finallyz)TraceTestCase.test_19_except_with_finally  s    	 	T		r   c                      G d d      fdfd}| j                         }g d}	  ||j                         | j                  j                  j
                  |j                  |       y # t        $ r Y =w xY w)Nc                       e Zd Zd Zd Zd Zy)BTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapperc                 $    t        |      | _        y r   )iter_it)r   objs     r   r   zKTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__init__*  s    9r   c                     | S r   r"   r   s    r   	__aiter__zLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__aiter__-      r   c                 \   K   	 t        | j                        S # t        $ r t        w xY wwr   )nextr=  StopIterationStopAsyncIterationr   s    r   	__anext__zLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__anext__0  s-     ->)$ -,,-s   , ,),N)r   r   r    r   r@  rF  r"   r   r   AsyncIteratorWrapperr:  )  s    %-r   rG  c                  @   K    d      2 3 d {   } | }7 6 d}y w)Nabc*   r"   )letterr,   rh   rG  s      r   
doit_asyncz8TraceTestCase.test_20_async_for_loop.<locals>.doit_async6  s.      4U ;  f ;As   	c                             }	 t        j                  |        |j                  d        t        j                  d        y # t        j                  d        w xY wr   )r~   r   send)r   r,   rL  s     r   runz1TraceTestCase.test_20_async_for_loop.<locals>.run;  s?    A#V$tT"T"s   &A A)(r@   rB   )irA   )rC   )rP  rE   irA   rC   rS  rE   r   r   r   r   r>   r{   rI   rB   r   r   r   r   rU  rI   rB   r   r   r   r   rU  rI   rB   r   r   r   r   rp   rC   rq   rz   rs   rU  rK   r\   )r   r   rv   r   r   r   r   )r   rO  r   r   rG  rL  s       @@r   test_20_async_for_loopz$TraceTestCase.test_20_async_for_loop(  s{    	- 	-	
	# !!#(R	 	J//>>"MM6	3  		s   A0 0	A<;A<c                    d fd}| j                         } |       }	 t        j                  |j                         |j	                  d        t        j                  d        g d}| j                  |j                  j                  |j                  |       y # t
        $ r Y Vw xY w# t        j                  d        w xY w)Nc                6   K   t        |       D ]  }| 	 y wr   r_   )nr   s     r   arangezGTraceTestCase.test_async_for_backwards_jump_has_no_line.<locals>.arangeu  s     1X s   c                  F   K    d      2 3 d {   } | dkD  s y 7 6 y w)NrL   d   r"   )r   r[  s    r   r!  zBTraceTestCase.test_async_for_backwards_jump_has_no_line.<locals>.fx  s,     !!9  as79s    	!!!!)r@   rB   ro   rq   r   r   rU  rI   rB   r   rA   rq   r   r   rU  rI   rB   r^  rq   r   r   rU  rI   rB   r^  rq   rs   rU  rD   )
r   r~   r   r   rN  rv   r   r   r   r   )r   r!  r   coror   r[  s        @r   )test_async_for_backwards_jump_has_no_linez7TraceTestCase.test_async_for_backwards_jump_has_no_linet  s    		
 !!#s	LL&IIdO LL
< 	AJJ55"MM6	3G  		 LLs#   0B 	B)&B, (B))B, ,Cc                 2    d }| j                  |g d       y )Nc                       	 y r   r"   r"   r   r   r   z1TraceTestCase.test_21_repeated_pass.<locals>.func  s    r   r@   rB   rI   re   r  r   s     r   test_21_repeated_passz#TraceTestCase.test_21_repeated_pass  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  "    	 dD ]  }  y#  Y yxY w)Nr"   r>   rJ   r"   r   s    r   r   z3TraceTestCase.test_loop_in_try_except.<locals>.func  s    !A!s   
 r[   r  r   s     r   test_loop_in_try_exceptz%TraceTestCase.test_loop_in_try_except  s    	 	T	r   c                 8    fd| j                  g d       y )Nc                  L    	 	 	 	 	  j                   dk(  r	 y 	 y #  Y y xY w# w xY wNFred)r   r   s   r   r   z8TraceTestCase.test_try_except_no_exception.<locals>.func  sF      ==F* +  s   ! ! ! #	r@   rB   rI   rc   rV   r   rC      rC      rC   rs  rE   r  r   s    @r   test_try_except_no_exceptionz*TraceTestCase.test_try_except_no_exception      	  	T		r   c                 2    d }| j                  |g d       y )Nc                  N    	 	 	 	 t         #  Y nxY w	 n# w xY w	 y #  Y y xY w# w xY wr   ru   r"   r   r   r   z6TraceTestCase.test_try_exception_in_else.<locals>.func  sE     #O	A
 BB s(       " " $)r@   rB   rI   rK   rV   r.  )r/  r{   ro  rp     rC   rr  rt  r  r   s     r   test_try_exception_in_elsez(TraceTestCase.test_try_exception_in_else  s    	  	T	r   c                 2    d }| j                  |g d       y )Nc                  V    t        d      D ]  } t        d      D ]  }| |z   }	  dk(  S )NrJ   r>   r_   )r   jra   s      r   r   z-TraceTestCase.test_nested_loops.<locals>.func  s<    1X q AAA 6Mr   )r@   rB   rI   rK   rI   rK   rI   rB   rI   rK   rI   rK   rI   rB   rT   rk   r  r   s     r   test_nested_loopszTraceTestCase.test_nested_loops  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  F    ddg} | r| j                         }|r	 |S | rd}|S )Nr>   r   c   r5   )seqrZ  s     r   r   z)TraceTestCase.test_if_break.<locals>.func  s7    a&CGGI H 
 Hr   )r@   rB   rI   rK   rT   rI   rK   rT   rM   r.  r/  rE   r  r   s     r   test_if_breakzTraceTestCase.test_if_break  s    	 	T
	r   c                 <    d }| j                  |g dddgz          y )Nc                      d\  } }}}	 t        d      D ]  }	 d} |dkD  r	 d} nd} d} | dk(  r
|dk(  r|dk(  sJ y # d}w xY w#  d}Y xY w)	N)r>   r>   r>   r  rL   rN   r   r   r/  rz  r>   r_   )ra   cdr   s       r   r   z6TraceTestCase.test_break_through_finally.<locals>.func6  s    $JAq!Q
q Aq5!   6a2g!q&00& s(   A <A <A A  A A	)r@   rB   rI   rK   rT   rM   rc   r.  ro  rK   rT   rM   rc   rV   ro     rC   r  rE   r  r   s     r   test_break_through_finallyz(TraceTestCase.test_break_through_finally4  s/    	1 	T ^,Q	Rr   c                 <    d }| j                  |g dddgz          y )Nc                      d\  } }}}}	 t        d      D ]  }	 d} |dkD  r	 d}d}d} 	 | |||fdk(  sJ y # d}w xY w#  d}Y xY w)	N)r>   r>   r>   r>   r  rJ   rN   r   r   r/  rz  )rN   r/  r   r>   r_   )ra   r   r  r  r   s        r   r   z9TraceTestCase.test_continue_through_finally.<locals>.funcY  s|    *MAq!Q
q Aq5$   q!Q<=000 s!   > 7> 7> ;> A)r@   rB   rI   rK   rT   rM   rc   r.  ro  rK   rT   rM   rc   rV   ro  rK   r  r  r  r   s     r   test_continue_through_finallyz+TraceTestCase.test_continue_through_finallyW  s/    	1 	T  ^,!P	Qr   c                 2    d }| j                  |g d       y )Nc                      	 	 y# w xY wr  r"   r"   r   r   r   z7TraceTestCase.test_return_through_finally.<locals>.func}  s    s   rj   r  r   s     r   test_return_through_finallyz)TraceTestCase.test_return_through_finally{  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  <    	 ddz   y# t         $ r Y yw xY w#  Y yxY w)NrJ   r   rd   )r   r"   r   r   r   z;TraceTestCase.test_try_except_with_wrong_type.<locals>.func  s0    !    s    	  )r@   rB   rI   r|   rK   rc   r   r  r   s     r   test_try_except_with_wrong_typez-TraceTestCase.test_try_except_with_wrong_type  s    	 	T	r   c                 <    dfd}| j                  |g d       y )NTc                  <    	 	 t         # rd} w w xY w#  d} Y | S xY wNr>   rL   ru   )result	conditions    r   r   z9TraceTestCase.test_finally_with_conditional.<locals>.func  s1    ##O !" !Ms   
  )r@   rB   rI   rK   r-  rM   rc   r.  r0  ro  r   rE   r  )r   r   r  s     @r   test_finally_with_conditionalz+TraceTestCase.test_finally_with_conditional  s&     	
	 	T
	r   c                 2    d }| j                  |g d       y )Nc                  :    d} dg}|r|j                          | r	 y r=   r5   TRUEr,   s     r   r   z3TraceTestCase.test_break_to_continue1.<locals>.func  s(    DA	 r   )
r@   rB   rI   rK   rT   rM   rc   rV   rK   r\   r  r   s     r   test_break_to_continue1z%TraceTestCase.test_break_to_continue1  s    	 	T	
	r   c                 2    d }| j                  |g d       y )Nc                  B    d} dg}|r|j                          | rn|ry y r=   r5   r  s     r   r   z3TraceTestCase.test_break_to_continue2.<locals>.func  s(    DA r   )	r@   rB   rI   rK   rT   rM   rc   rK   r\   r  r   s     r   test_break_to_continue2z%TraceTestCase.test_break_to_continue2  s    	 	T		r   c                 2    d }| j                  |g d       y )Nc                      d} | r| r	 y y y r=   r"   )r  s    r   r   z/TraceTestCase.test_break_to_break.<locals>.func  s    D r   )r@   rB   rI   rK   rT   rM   rO   r  r   s     r   test_break_to_breakz!TraceTestCase.test_break_to_break  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  0    dx} }| dk(  r|dk(  rd}y d}y d}y )Nr>   rU   rd   r/  r"   )ra   r   r,   rh   zs        r   r   z+TraceTestCase.test_nested_ifs.<locals>.func  s(    IAAv6AAr   r   r  r   s     r   test_nested_ifszTraceTestCase.test_nested_ifs  s    	 	T	r   c                 L    fd}dxd| j                  |g d       y )Nc                  B     rr	r	t         ryyy y t        rt        ryy y )NFT)DEF)ABCs   r   r   z4TraceTestCase.test_nested_ifs_with_and.<locals>.func  s0    #(   
 q r   TFr[   r  )r   r   r  r  r  s     @@@r   test_nested_ifs_with_andz&TraceTestCase.test_nested_ifs_with_and  s-    		 AT	r   c                 2    d }| j                  |g d       y )Nc                  X    d} 	 ddz   d}y # t         $ r | dk(  r
t               Y d}y w xY w)NhellorL   r   raiserW   )ZeroDivisionError
ValueError)r,   r!  s     r   r   z.TraceTestCase.test_nested_try_if.<locals>.func'  sD    A'! A % '<$,&  A's    ))	r@   rB   rI   rK   r-  rT   rM   rV   rX   r  r   s     r   test_nested_try_ifz TraceTestCase.test_nested_try_if%      	 	T		r   c                 L     G d d      fd}| j                  |g d       y )Nc                       e Zd Zd Zd Zy).TraceTestCase.test_if_false_in_with.<locals>.Cc                     | S r   r"   r   s    r   r   z8TraceTestCase.test_if_false_in_with.<locals>.C.__enter__>  rA  r   c                       y r   r"   r   s    r   r   z7TraceTestCase.test_if_false_in_with.<locals>.C.__exit__@      r   Nr   r   r    r   r   r"   r   r   r  r  =      r   r  c                  @             5  	 d d d        y # 1 sw Y   y xY wr   r"   r  s   r   r   z1TraceTestCase.test_if_false_in_with.<locals>.funcC  s        s   )r@   rB   r   rA   r   r   rI   rB   ro   rq   rs   rD   r  )r   r   r  s     @r   test_if_false_in_withz#TraceTestCase.test_if_false_in_with;  s)    	 		
 	T
	r   c                 2    d }| j                  |g d       y )Nc                  0    	 y # t         $ r	 t         Y y w xY wr   )rv   Xr"   r   r   r   z7TraceTestCase.test_if_false_in_try_except.<locals>.funcW  s     s   rc  r  r   s     r   test_if_false_in_try_exceptz)TraceTestCase.test_if_false_in_try_exceptU  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                       G d d      } y )Nc                        e Zd Zddk  rdZydZy)DTraceTestCase.test_implicit_return_in_class.<locals>.func.<locals>.ArL   r1  r>   rJ   N)r   r   r    ra   r"   r   r   r  r  g  s    q5AAr   r  r"   )r  s    r   r   z9TraceTestCase.test_implicit_return_in_class.<locals>.funcf  s     r   r@   rB   r>   rA   rB   rI   rK   r\   rD   r  r   s     r   test_implicit_return_in_classz+TraceTestCase.test_implicit_return_in_classd  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  R    	 	 y # t         $ r
} Y d } ~ y d } ~ ww xY w# t         $ r Y y w xY wr   ru   exs    r   r   z+TraceTestCase.test_try_in_try.<locals>.funcx  s3       s   	  	&&r[   r  r   s     r   test_try_in_tryzTraceTestCase.test_try_in_tryw  s    	 	T	r   c                 `    d }| j                  |g d       d }| j                  |g d       y )Nc                  \    	 	 t         # t        $ r
} Y d } ~ y d } ~ ww xY w# t         $ r Y y w xY wr   )	TypeErrorr  r  s    r   r   z:TraceTestCase.test_try_in_try_with_exception.<locals>.func  s5    #O!     	 	  	++	r@   rB   rI   rK   r-  rT   rc   rV   rX   c                  \    	 	 t         # t         $ r
} Y d } ~ y d } ~ ww xY w# t        $ r Y y w xY wr   r  r  r  s    r   r   z:TraceTestCase.test_try_in_try_with_exception.<locals>.func  s6    $$!  r  )r@   rB   rI   rK   r-  rT   rM   rO   r  r   s     r   test_try_in_try_with_exceptionz,TraceTestCase.test_try_in_try_with_exception  s:    	 	T			 	T	r   c                 4    dd}| j                  |g d       y )Nc                     |r| r|ry y y y r   r"   )ra   pr  s      r   r   z/TraceTestCase.test_if_in_if_in_if.<locals>.func  s    	  r   rc  )r   r>   r>   r  r   s     r   test_if_in_if_in_ifz!TraceTestCase.test_if_in_if_in_if  s    	 	T	r   c                 ~     G d d      fd}fd}| j                  |g d       | j                  |g d       y )Nc                       e Zd Zd Zd Zy)-TraceTestCase.test_early_exit_with.<locals>.Cc                     | S r   r"   r   s    r   r   z7TraceTestCase.test_early_exit_with.<locals>.C.__enter__  rA  r   c                       y r   r"   r   s    r   r   z6TraceTestCase.test_early_exit_with.<locals>.C.__exit__  r  r   Nr  r"   r   r   r  r    r  r   r  c                  P    dD ]  }         5  	 d d d         y  y # 1 sw Y   !xY w)Nr>   rJ   r"   )r   r  s    r   
func_breakz6TraceTestCase.test_early_exit_with.<locals>.func_break  s<     S    s   %	c                  @             5  	 d d d        y # 1 sw Y   y xY wr   r"   r  s   r   func_returnz7TraceTestCase.test_early_exit_with.<locals>.func_return  s        s   )r@   rB   rI   r  r   r   rK   rI   ro   rq   rs   rT   rk   )r@   rB   )rP  rA   )rC   )r  rE   rI   rB   rQ  rR  rT  rD   r  )r   r  r  r  s      @r   test_early_exit_withz"TraceTestCase.test_early_exit_with  sE    	 			 	Z	 	[
	r   c                 >    d fd}| j                  |g d       y )Nc                 @    | r	 d| dz
  z   | S | S # t         $ r Y | S w xY wr=   r  rG   s    r   fooz;TraceTestCase.test_flow_converges_on_same_line.<locals>.foo  s9    q1uI H1H ) Hs    	c                  6    t        d      D ]
  }  |         y r  r_   )r   r  s    r   r   z<TraceTestCase.test_flow_converges_on_same_line.<locals>.func  s    1X Ar   )r@   rB   rI   rS  rA   irC   rq   rs   rB   rI   r  r  )r   rC   r   )r   r{   r   rV  rq   rs   rB   rD   r  )r   r   r  s     @r    test_flow_converges_on_same_linez.TraceTestCase.test_flow_converges_on_same_line  s$    		 	T	r   c                 2    d }| j                  |g d       y )Nc                  F    d} 	 d| z   y# t         $ r}| r Y d }~yd }~ww xY w)Nr   r>   doner  )r,   errors     r   r   zCTraceTestCase.test_no_tracing_of_named_except_cleanup.<locals>.func  s8    A!  %  s   
 	  r  r  r   s     r   'test_no_tracing_of_named_except_cleanupz5TraceTestCase.test_no_tracing_of_named_except_cleanup  s    	 	T			r   c                 L     G d d      fd}| j                  |g d       y )Nc                       e Zd Zd Zd Zy)DTraceTestCase.test_tracing_exception_raised_in_with.<locals>.NullCtxc                     | S r   r"   r   s    r   r   zNTraceTestCase.test_tracing_exception_raised_in_with.<locals>.NullCtx.__enter__-  rA  r   c                      y r   r"   )r   excinfos     r   r   zMTraceTestCase.test_tracing_exception_raised_in_with.<locals>.NullCtx.__exit__/  r  r   Nr  r"   r   r   NullCtxr  ,  r  r   r  c                  h    	          5  ddz   d d d        y # 1 sw Y   y xY w# t         $ r Y y w xY wNr>   r   r  )r  s   r   r   zATraceTestCase.test_tracing_exception_raised_in_with.<locals>.func2  s:    Y aC  $ s    % % "% % 	11)r@   rB   rI   r  r   r   rK   r-  rI   ro   rq   rs   rT   rM   rO   r  )r   r   r  s     @r   %test_tracing_exception_raised_in_withz3TraceTestCase.test_tracing_exception_raised_in_with*  s)    	 		 	T	r   c                 8    fd| j                  g d       y )Nc                  x    	 	 	 	 	  j                  dk(  r	 y # g xt         % x n nn x Y y cY w xY w# w xY wrk  )rv   r   rm  s   r   r   z=TraceTestCase.test_try_except_star_no_exception.<locals>.funcL  sL      ==F*I  s   7 47 7 9rn  r  r   s    @r   !test_try_except_star_no_exceptionz/TraceTestCase.test_try_except_star_no_exceptionJ  rv  r   c                 2    d }| j                  |g d       y )Nc                  ^    	 	 	 y # g xt         % x} d } ~ nd } ~  nn x Y y cY w xY w# w xY wr   ru   r   s    r   r   zCTraceTestCase.test_try_except_star_named_no_exception.<locals>.funci  s4     I 
 s   * '* * ,)r@   rB   rI   rc   r.  r  r  r   s     r   'test_try_except_star_named_no_exceptionz5TraceTestCase.test_try_except_star_named_no_exceptiong  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  b    	 t        d      # g xt         % x n nn x Y y cY w xY w# w xY wr  r  r"   r   r   r   zATraceTestCase.test_try_except_star_exception_caught.<locals>.func}  s3     m#J 
 s    ), , .r@   rB   rI   r|   rK   rT   r.  r  r  r   s     r   %test_try_except_star_exception_caughtz3TraceTestCase.test_try_except_star_exception_caught{      	 	T	r   c                 2    d }| j                  |g d       y )Nc                  n    	 t        d      # g xt         % x} d } ~ nd } ~  nn x Y y cY w xY w# w xY wr  r  r  s    r   r   zGTraceTestCase.test_try_except_star_named_exception_caught.<locals>.func  s3     m#J 
 s    /2 2 4r  r  r   s     r   +test_try_except_star_named_exception_caughtz9TraceTestCase.test_try_except_star_named_exception_caught  r  r   c                 2    d }| j                  |g d       y )Nc                  x    	 	 t        d      # g xt        % x n nn x Y y cY w xY w# t         $ r Y y w xY wNrL   r  r"   r   r   r   zETraceTestCase.test_try_except_star_exception_not_caught.<locals>.func  sA    $Q-'	 A s    *- - 	99r  r  r   s     r   )test_try_except_star_exception_not_caughtz7TraceTestCase.test_try_except_star_exception_not_caught  r  r   c                 2    d }| j                  |g d       y )Nc                      	 	 t        d      # g xt        % x} d } ~ nd } ~  nn x Y y cY w xY w# t         $ r Y y w xY wr  r  r  s    r   r   zKTraceTestCase.test_try_except_star_named_exception_not_caught.<locals>.func  sA    $Q-'	 A s    03 3 	??r  r  r   s     r   /test_try_except_star_named_exception_not_caughtz=TraceTestCase.test_try_except_star_named_exception_not_caught  r  r   c                 2    d }| j                  |g d       y )Nc                     	 	 t        dt        d      t        d      g      # g xt        % x} d } ~ nd } ~  nn t        % x n nn t        % x   n x Y ycY w xY w# g xt        % xF 	 t        d      # g xt        % x n nn t        % x} d } ~ nd } ~  nn x Y ncY w xY wn nn x Y ycY w xY w)NegrN   zbad typers  r   )ExceptionGroupr  r  OSErrorr  s    r   r   z7TraceTestCase.test_try_except_star_nested.<locals>.func  s    	(#A	*(=>@ @	 A A"  J #B-' B! B s?    # 0A"A		A"A% A% %C2A==,B.)B2	1C)r@   rB   rI   rK   rT   rM   rK   r-  rc   rV   r.  ro  rp  ry  r  rr  )rs  r{   )   rC   )   rC   )   rC   )   rC   )r)  rE   r  r   s     r   test_try_except_star_nestedz)TraceTestCase.test_try_except_star_nested  s    	* 	T	r   c                 2    d }| j                  |g d       y )Nc                      	 d  y )Nc                      yr  r"   rG   s    r   <lambda>zATraceTestCase.test_notrace_lambda.<locals>.func.<locals>.<lambda>  s    r   r"   r"   r   r   r   z/TraceTestCase.test_notrace_lambda.<locals>.func  s    r   r[   r  r   s     r   test_notrace_lambdaz!TraceTestCase.test_notrace_lambda  s    	
 	T	r   c                 2    d }| j                  |g d       y )Nc                       G d d      } y )Nc                       e Zd ZdZd Zy)PTraceTestCase.test_class_creation_with_docstrings.<locals>.func.<locals>.Class_1z the docstring. 2c                     d| _         y)z Another docstring. 4rN   N)ra   r   s    r   r   zYTraceTestCase.test_class_creation_with_docstrings.<locals>.func.<locals>.Class_1.__init__  s	    DFr   N)r   r   r    r!   r   r"   r   r   Class_1r3    s
    'r   r5  r"   )r5  s    r   r   z?TraceTestCase.test_class_creation_with_docstrings.<locals>.func  s     r   r  r  r   s     r   #test_class_creation_with_docstringsz1TraceTestCase.test_class_creation_with_docstrings  s    	 	T	r   c                 2    d }| j                  |g d       y )Nc                  ^    d }  | d       | t        dg             G d d                    }y )Nc                     d }|S )Nc                     | S r   r"   )r  s    r   _decz_TraceTestCase.test_class_creation_with_decorator.<locals>.func.<locals>.decorator.<locals>._dec'  s    Hr   r"   )r   r;  s     r   	decoratorzQTraceTestCase.test_class_creation_with_decorator.<locals>.func.<locals>.decorator&  s    r   rd   r/  c                       e Zd Zy)PTraceTestCase.test_class_creation_with_decorator.<locals>.func.<locals>.MyObjectN)r   r   r    r"   r   r   MyObjectr>  +  s    
 r   r?  )len)r<  r?  s     r   r   z>TraceTestCase.test_class_creation_with_decorator.<locals>.func%  s:    
 q\QC  r   )r@   rB   rc   r  rI   rT   rk   rV   r.  rV   r  rI   rT   rk   ro  )rd   rA   rc   rp  )rq  rE   rV   rJ   rA   rK   r\   rc   rA  rK   r\   ro  r  r  r   s     r   "test_class_creation_with_decoratorz0TraceTestCase.test_class_creation_with_decorator$  s    	 	T $
 	r   c                 n  	 t        j                  d      }d 		fd}g d}g }|j                  |        |        t        j                  d        |j
                  j                  }|D cg c]  \  }}}||z
  t        |   f }}}}| j                  ||       | j                  ||       y c c}}}w )N	_testcapic               3      K   d y wr=   r"   r"   r   r   genzFTraceTestCase.test_no_line_event_after_creating_generator.<locals>.genY  s     Gs   c                              D ]  }  y r   r"   )_rF  s    r   r   zGTraceTestCase.test_no_line_event_after_creating_generator.<locals>.func\  s     r   )r@   rI   rB   ro   rq   rs   rT   rB   )rr   rA   rs   rD   )
r   import_modulesettrace_to_recordr~   r   r   r   EVENT_NAMESassertEqualr   )
r   rD  r   EXPECTED_EVENTSr   
start_linewhatrC   r   rF  s
            @r   +test_no_line_event_after_creating_generatorz9TraceTestCase.test_no_line_event_after_creating_generatorR  s    
 "//<			
  $$V,dfcll46H]]11
 &,
 
!tS *_k$/0
 
 	1T?3
s   .B0c                    dfd}	 |t        j                         _        t        j                  |       t	        g        | j                  d       t        j                  d        y # t        $ r~}d}|j                  }|r7|j                  j                  j                  dk(  r|dz  }|j                  }|r7|dk(  r| j                  d       n|dkD  r| j                  d       Y d }~d }~ww xY w# t        j                  d        w xY w)	NFc                 $    sdt         t        S r   )rv   r  )r   r   r   raiseds      r   
error_oncez5TraceTestCase.test_settrace_error.<locals>.error_once  s    Lr   No exception raisedr   test_settrace_errorr>   Traceback is missing frame"Traceback has frame more than once)r~   r   r   r   r@  r   rv   __traceback__tb_framef_codeco_nametb_next)r   rT  r  counttbrS  s        @r   rV  z!TraceTestCase.test_settrace_error~  s    		&0CMMO#LL$G II+,LL  
	@E!!B;;%%--1FFQJEZZ  z		67		>?
	@ LLs6   9A* C4 *	C13AC,:-C,'C4 ,C11C4 4Dc                    t        j                  d      }	 |j                  g        t        g        | j	                  d       t        j                  d        y # t
        $ r~}d}|j                  }|r7|j                  j                  j                  dk(  r|dz  }|j                  }|r7|dk(  r| j	                  d       n|dkD  r| j	                  d       Y d }~d }~ww xY w# t        j                  d        w xY w)NrD  rU  r   test_testcapi_settrace_errorr>   rW  rX  )r   rI  settrace_to_errorr@  r   rv   rY  rZ  r[  r\  r]  r~   r   )r   rD  r  r^  r_  s        r   ra  z*TraceTestCase.test_testcapi_settrace_error  s     "//<		''+G II+,LL  
	@E!!B;;%%--1OOQJEZZ  z		67		>?
	@ LLs5   A C$ 	C!#AC*-CC$ C!!C$ $C;c                 d    i }t        dddz  d|       |d   }g d}| j                  ||       y )Nzdef f():              # line 0
            x = 0                     # line 1
            y = 1                     # line 2
            r   i   zn                        # lines 3 through (1 << 16)
            x += 1                    #
            returnr!  )r@   rB   rI   )i  rC   )  rC   )rd  rE   r#  )r   r  r!  rM  s       r   test_very_large_functionz&TraceTestCase.test_very_large_function  sG    
 ),
 ./	0 cF
 	Q0r   N)Or   r   r    r   r   staticmethodr   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r	  r  r  r  r  r  r  r  r&  r*  r2  r7  rW  r`  rd  rh  ru  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  r  r  r  r  r   r*  r/  r6  rB  r   cpython_onlyrP  rV  ra  re  r"   r   r   r   r   Y  s   6
  D308&&&&&%#",+')+E
>0*J3X23h	":@42!RF"QH&:..$(.,4&"'R",\"H,@:(,,,,-^&,\ )4 )4V<  01r   r   )rA   r{   rC   rE   c                   2     e Zd ZdZ fdZed        Z xZS )SkipLineEventsTraceTestCasez8Repeat the trace tests, but with per-line events skippedc                 b    |D cg c]  }|d   dk7  s| }}t         |   |||       y c c}w )Nr>   rC   )superr   )r   r   r   r   r   skip_line_events	__class__s         r   r   z*SkipLineEventsTraceTestCase.compare_events  s9    '6I!!A$&.AII{F4DE Js   ,,c                      t        d      S )NF)r   r   r"   r   r   r   z'SkipLineEventsTraceTestCase.make_tracer  s    ..r   r   r   r    r!   r   rf  r   __classcell__rm  s   @r   ri  ri    s     BF / /r   ri  c                   2     e Zd ZdZ fdZed        Z xZS )TraceOpcodesTestCasez;Repeat the trace tests, but with per-opcodes events enabledc                     |D cg c]  }|d   dk7  s| }}t        |      dkD  r&| j                  t        |      t        |      d       t        |   |||       y c c}w )Nr>   opcodez)No 'opcode' events received by the tracer)msg)r@  
assertLessrk  r   )r   r   r   r   r   skip_opcode_eventsrm  s         r   r   z#TraceOpcodesTestCase.compare_events  sh    )/DA1Q483CaDDv;?OOC 23S[ K  M{,>P	 Es
   A A c                      t        d      S )NT)r   r   r"   r   r   r   z TraceOpcodesTestCase.make_tracer  s    $//r   ro  rq  s   @r   rs  rs    s     EQ 0 0r   rs  c                   N    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zy)RaisingTraceFuncTestCasec                 h    | j                  t        j                  t        j                                y r   r   r~   r   r   r   s    r   r   zRaisingTraceFuncTestCase.setUp  s    clln5r   c                 D    || j                   k(  rt        | j                  S )zXA trace function that raises an exception in response to a
        specific trace event.)raiseOnEventr  r   r   s       r   r   zRaisingTraceFuncTestCase.trace  s"     D%%%::r   c                 2    | j                   dk(  rd}d|z  }yy)zThe function to trace; raises an exception if that's the case
        we're testing, so that the 'exception' trace event fires.r{   r   r>   N)r  )r   r,   rh   s      r   r!  zRaisingTraceFuncTestCase.f  s#     +A!Ar   c                 >   || _         	 t        t        j                         dz         D ]C  }t        j                  | j
                         	 | j                          | j                  d       E y# t        $ r Y Rw xY w# t        $ r | j                  d       Y yw xY w)zTTests that an exception raised in response to the given event is
        handled OK.r>   zexception not raised!zrecursion counter not resetN)
r  r`   r~   getrecursionlimitr   r   r!  r   r  r   )r   r   r   s      r   run_test_for_eventz+RaisingTraceFuncTestCase.run_test_for_event  s     "
	53002Q67 7TZZ(7FFH II567 "   	5II34	5s6   AA? A0A? 0	A<9A? ;A<<A? ?BBc                 &    | j                  d       y )NrA   r  r   s    r   	test_callz"RaisingTraceFuncTestCase.test_call      'r   c                 &    | j                  d       y )NrC   r  r   s    r   	test_linez"RaisingTraceFuncTestCase.test_line  r  r   c                 &    | j                  d       y )NrE   r  r   s    r   test_returnz$RaisingTraceFuncTestCase.test_return  s    )r   c                 &    | j                  d       y Nr{   r  r   s    r   test_exceptionz'RaisingTraceFuncTestCase.test_exception  s    ,r   c                     d fdt        j                         	          | j                  d       y # t        $ r dd l} |j
                          Y y w xY w)Nc                  :    t        d      D ]  } t        |         y )NrN   )r`   printrg  s    r   r!  z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.f   s    1X ar   c                 t    |dk(  r1| j                   j                  j                  dz   k(  rt        d      S )NrC   rJ   zi am crashing)r   r   r   r   )r   whyextrar!  gs      r   r  z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.g$  s5    v!**";";a"??"?33Hr   zexception not propagatedr   )r~   r   r   r   r   collect)r   r   r!  r  s     @@r   test_trash_stackz)RaisingTraceFuncTestCase.test_trash_stack  sR    		 	Q	2C II01  	BJJL	s   ; AAc                      d } fdt        j                         }	 t        j                         	  |        t        j                  |       y # t        $ r Y !w xY w# t        j                  |       w xY w)Nc                       d} | j                    y )Nr   )no_such_attrrG   s    r   r!  z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.f6  s    ANNr   c                 J    |dk(  r|\  }}}j                  |t               S r  )assertIsInstancerv   )r   r   r   typer{   r   r  r   s         r   r  z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g:  s,    $),&i%%i;Hr   )r~   r   r   AttributeError)r   r!  existingr  s   `  @r   test_exception_argumentsz1RaisingTraceFuncTestCase.test_exception_arguments5  se    		 <<>	#LLO
 LL"	 "  LL"s(   A# A 	A A# A  A# #A:c                     t        d      fdd }| j                  t               5 }t        j                          |        d d d        | j	                  j
                         y # 1 sw Y   &xY w)NzBOOM!c                 $    |dk(  rd| _         S )NrC   T)r   )r   r   r   r{   r   s      r   r   zRRaisingTraceFuncTestCase.test_line_event_raises_before_opcode_event.<locals>.traceM  s    $(E!Lr   c                       y r   r"   r"   r   r   r!  zNRaisingTraceFuncTestCase.test_line_event_raises_before_opcode_event.<locals>.fR  r   r   )r  assertRaisesr~   r   assertIsr{   )r   r!  caughtr{   r   s      @@r   *test_line_event_raises_before_opcode_eventzCRaisingTraceFuncTestCase.test_line_event_raises_before_opcode_eventK  sc    w'		
	z* 	fLLC	 	f&&	2	 	s   A..A7N)r   r   r    r   r   r!  r  r  r  r  r  r  r  r  r"   r   r   r{  r{    s9    65"((*-2,#,3r   r{  c                   "    e Zd ZdZ	 	 ddZd Zy)
JumpTracerz>Defines a trace function that jumps from one place to another.c                     |j                   | _        || _        || _        || _        |rd n| j                  j
                  | _        d| _        y )NF)r   codejumpFromjumpTor   r   	firstLiner  )r   functionr  r  r   	decorateds         r   r   zJumpTracer.__init__a  s@    %%	 
!*		0H0H	r   c                 L   | j                   ry | j                  2|j                  | j                  k(  r|dk(  r|j                  dz
  | _        || j
                  k(  r| j                  |j                  | j                  | j                  z   k(  rm|}|A|j                  | j                  k7  r(|j                  }||j                  | j                  k7  r(|&	 | j                  | j                  z   |_        d| _         | j                  S # t        $ r | j                  |_        Y /w xY w)NrC   r>   T)r  r  r[  r  r   r   r  r   r  r  r   )r   r   r   r   r!  s        r   r   zJumpTracer.tracej  s    99
 NN"u||tyy'@"^^a/DNTZZDNN$>$..4=="@@A-AHH		$9HH -AHH		$9}1%)^^dkk%AEN !	zz ! 1%)[[EN1s   D D#"D#N)rC   F)r   r   r    r!   r   r   r"   r   r   r  r  ^  s    H9? r   r  c                     	 | j                  d       y # t        $ r&}| j                  dt        |      v        Y d }~y d }~ww xY w)NrJ   integer)r   r  r   r   r   s     r   no_jump_to_non_integersr    s;    +a +i3q6)**+s    	A>Ac                      	 t        j                         j                  } | j                  | _        t	        d      # t
        $ r}dt        |      vr Y d }~y d }~ww xY w)Nz'Trace-function-less jump failed to failr   )r~   r   r   r   AssertionErrorr  r   )previous_framer   s     r   no_jump_without_trace_functionr    s]    
H//"0"9"9 FGG   #a&  !s   /< 	AAAc                      e Zd ZdZd Zd Z	 	 ddZ	 	 ddZddZddZ	 ed	d
d
g      d        Z
 edd	g d      d        Z ed	ddgeef      d        Z eddg d      d        Z edddg      d        Z eddg d      d        Z ed
dddgeef      d        Z edd	g d      d        Z e	ddd
dg      ed               Z e	ddg d      ed               Z ed	dd
g      d        Z eddg d       d!        Z edd"dd"g      d#        Z edd$dd$ged%f      d&        Z edd'dd'ged%f      d(        Z edd'ddged)f      d*        Z ed
dd	ged+f      d,        Z eddddg      d-        Z edd
g d.      d/        Z  edd
d	d
g      d0        Z! e	dd
d	d
g      d1        Z" ed
d	g d2      d3        Z# e	d
d	g d2      d4        Z$ edddg      d5        Z% ed
d	g d6      d7        Z& edddg      d8        Z' ed
d	g d9      d:        Z( edd$g d;      d<        Z) edd$g d;      d=        Z* eddg d>      d?        Z+ edd	g d@eef      dA        Z, eddg dB      dC        Z- e	ddg dB      dD        Z. eddg dE      dF        Z/ e	ddg dE      dG        Z0 eddg dH      dI        Z1 e	ddg dH      dJ        Z2 eddg dK      dL        Z3 e	ddg dK      dM        Z4 edNd'g dO      dP        Z5 ed
dg dQeef      dR        Z6 e	d
dg dQeef      dS        Z7 ed
dg dT      dU        Z8 eddNg dV      dW        Z9 ed	d$d$dNgeef      dX        Z: e	d	d$d$dNgeef      dY        Z; edd
d	ged+f      dZ        Z< edd[d	ged\f      d]        Z= edd
dged^f      d_        Z> edd
dged^f      d`        Z? edd
dged^f      da        Z@ edd
dged^f      db        ZA ed	d
g edcf      dd        ZB e	d	d
g edcf      de        ZC ed
dddgedcf      df        ZD e	d
dddgedgf      dh        ZE ed	d
g edif      dj        ZF e	d	d
g edif      dk        ZG ed
dg dledif      dm        ZH e	d
dg dledif      dn        ZI ed	d
d
dg      do        ZJ eddg dp      dq        ZK ed	d
d
g      dr        ZL eddg ds      dt        ZM edd$g d;eef      du        ZN ed	ddg      dv        ZO ed
dg dw      dx        ZP edd	g dy      dz        ZQ ed	dg ed{f      d|        ZR ed	dg ed{f      d}        ZS ed
dg d~ed{f      d        ZT ed
ddged{f      d        ZU ed$d	g d      d        ZV ed$d	g d      d        ZW ed
dg d      d        ZX e	d
dg d      d        ZY edd$ddged+f      d        ZZ ed$dd	dgedcf      d        Z[ e	d$dd	dgedcf      d        Z\d Z]d Z^d Z_d Z` edd
d	gdedf      d        Za edd	d	gdedf      d        Zb edd	d	gdedf      d        Zc ed
dddgd      d        Zd edd
d	d
geef      d        Ze ed
d	g eef      d        Zf edNdg deef      d        Zg e	dd
d	d
geef      d        Zh e	d
d	g eef      d        Zi e	dNdg deef      d        Zj ed
d$g edif      d        Zk eddNg edif      d        Zl ed
d$g edif      d        Zm edd
d	d
geef      d        Zn ed
dg deef      d        Zo epj                  d      d        Zr edd
d	d
geef      d        Zsy)JumpTestCasez&assigning None to [0-9]+ unbound localc                     | j                  t        j                  t        j                                t        j                  d        y r   r}  r   s    r   r   zJumpTestCase.setUp  &    clln5Tr   c                 n    ||k7  r0| j                  dt        |      z   dz   dz   t        |      z          y y )NzOutputs don't match:
Expected: r   z
Received: )r   repr)r   expectedreceiveds      r   compare_jump_outputz JumpTestCase.compare_jump_output  sH    xII $&*8n57;<#$&*8n5 6  r   Nc	                 T   |}	t        |	d      r|	j                  }	t        |	d      rt        |	||||      }
t        j                  |
j
                         g }t        j                         5 }||j                   | j                  |        ||j                   | j                  |        n8|j                  t        j                                t        j                  d        ||       d d d        t        j                  d        | j                  ||       y # 1 sw Y   1xY w)N__wrapped__r  )hasattrr  r  r~   r   r   
contextlib	ExitStackenter_contextassertRaisesRegexassertWarnsRegexwarningscatch_warningssimplefilterr  r   r   r  r  r  r  r   r  warningwrappedr   r   stacks                r   r   zJumpTestCase.run_test  s   g}-))G g}- GXvuiHV\\"!!# 	u ##$:D$:$:E$BC"##$9D$9$97$CD##H$;$;$=>%%g.L	 	T  62	 	s   ,BDD'c	                 2   |}	t        |	d      r|	j                  }	t        |	d      rt        |	||||      }
t        j                  |
j
                         g }t        j                         5 }||j                   | j                  |        ||j                   | j                  |        t        j                   ||             d d d        t        j                  d        t        j                  d        | j                  ||       y # 1 sw Y   FxY w)Nr  )r  r  r  r~   r   r   r  r  r  r  r  asynciorO  set_event_loop_policyr  r  s                r   run_async_testzJumpTestCase.run_async_test  s    g}-))G g}- GXvuiHV\\"!!# 	&u ##$:D$:$:E$BC"##$9D$9$97$CDKKV%	& 	T%%d+  62	& 	&s   ,ADDc                 &      fd}|S )zqDecorator that creates a test that makes a jump
        from one place to another in the following code.
        c                 <     t                fd       }|S )Nc           
      8    | j                  d       y NT)r  r   r  r  )r   r   r  r   r  r   r  r  r  s    r   r9   z7JumpTestCase.jump_test.<locals>.decorator.<locals>.test  s'    dHfh$)$PW  Yr   r   r   r9   r  r   r  r  r  r  s   ` r   r<  z)JumpTestCase.jump_test.<locals>.decorator  (    4[Y Y Y Kr   r"   r  r  r  r  r   r  r<  s   `````` r   	jump_testzJumpTestCase.jump_test      	 	 r   c                 &      fd}|S )z~Decorator that creates a test that makes a jump
        from one place to another in the following asynchronous code.
        c                 <     t                fd       }|S )Nc           
      8    | j                  d       y r  )r  r  s    r   r9   z=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.test  s)    ##D(FH$)$PW $ Yr   r   r  s   ` r   r<  z/JumpTestCase.async_jump_test.<locals>.decorator  r  r   r"   r  s   `````` r   async_jump_testzJumpTestCase.async_jump_test  r  r   r>   rL   c                 j    | j                  d       | j                  d       | j                  d       y Nr>   rJ   rL   r   r   s    r   test_jump_simple_forwardsz&JumpTestCase.test_jump_simple_forwards  &    aaar   rJ   )r>   r>   rJ   c                 H    | j                  d       | j                  d       y r^   r  r  s    r   test_jump_simple_backwardsz'JumpTestCase.test_jump_simple_backwards      aar   rU   rN   r  c                 R    d }|| j                  d       y | j                  d       y NrL   rN   r  r   r,   s     r   test_jump_is_none_forwardsz'JumpTestCase.test_jump_is_none_forwards  s$    9MM!MM!r   rd   )rL   rN   rd   c                 t    d }|| j                  d       n| j                  d       | j                  d       y NrL   rN   rd   r  r  s     r   test_jump_is_none_backwardsz(JumpTestCase.test_jump_is_none_backwards   s0    9MM!MM!ar   c                 R    d }|| j                  d       y | j                  d       y r  r  r  s     r   test_jump_is_not_none_forwardsz+JumpTestCase.test_jump_is_not_none_forwards	  s$    =MM!MM!r   )rN   rN   rd   c                 t    d }|| j                  d       n| j                  d       | j                  d       y r  r  r  s     r   test_jump_is_not_none_backwardsz,JumpTestCase.test_jump_is_not_none_backwards  s0    =MM!MM!ar   c                     dD ]+  }| j                  d       dD ]  }| j                  d        - | j                  d       y )Nr  rJ   rL   rU   rN   r  r   r   r~  s      r   test_jump_out_of_block_forwardsz,JumpTestCase.test_jump_out_of_block_forwards  sF     	!AMM! !a !	! 	ar   )r>   rL   rN   r>   rL   rN   rd   rW   c                     | j                  d       dD ]<  }| j                  d       dD ]  }| j                  d        | j                  d       > | j                  d       y )Nr>   r   rL   )rJ   rN   rd   rW   r  r  s      r    test_jump_out_of_block_backwardsz-JumpTestCase.test_jump_out_of_block_backwards"  s^    a 	AMM! !a !MM!		
 	ar   c                    K   dD ]7  } |ddg      2 3 d {   }| j                  d       | j                  d       , y 7 )6 | j                  d       Pw)Nr   r>   rJ   rL   rU   rN   r  r   r-   r   s      r   )test_jump_out_of_async_for_block_forwardsz6JumpTestCase.test_jump_out_of_async_for_block_forwards,  s^       	A$aV, ! !aa a 	!, MM!s%   AAA A&A AA)rJ   rU   rJ   rU   rN   rd   c                    K   dD ]G  }| j                  d        |dg      2 3 d {   }| j                  d       | j                  d       , y 7 )6 | j                  d       `w)Nr   rJ   r>   rU   rN   rd   r  r   s      r   *test_jump_out_of_async_for_block_backwardsz7JumpTestCase.test_jump_out_of_async_for_block_backwards5  sf       	AMM!$aS> ! !aa a 		!> MM!s%    A%AAA&A%AA%c                 H    | j                  d       | j                  d       y r  r  r  s    r   test_jump_to_codeless_linez'JumpTestCase.test_jump_to_codeless_line?  s    aar   )r>   rJ   rL   c                 j    | j                  d       | j                  d       | j                  d       y r  r  r  s    r   test_jump_to_same_linez#JumpTestCase.test_jump_to_same_lineE  r  r   r1  c                    	 | j                  d       | j                  d       	 | j                  d       | j                  d       | j                  d       y # | j                  d       w xY w# | j                  d       	 | j                  d       | j                  d       n# | j                  d       w xY w| j                  d       w xY w)NrJ   rU   rd   r/  r1  r  r  s    r   test_jump_in_nested_finallyz(JumpTestCase.test_jump_in_nested_finallyL  s    	MM!MM!!a a MM! a 	 MM!!a a a MM!s.   A/ A A,/CB%C%B88CrW    c                     	 | j                  d       ddz   	 | j                  d       | j                  d       y # | j                  d       | j                  d       w xY w)NrJ   r>   r   rd   rW   r  r  s    r   test_jump_in_nested_finally_2z*JumpTestCase.test_jump_in_nested_finally_2X  sQ    	MM!aCMM!MM! MM!MM!s	   < $A rq  c                    	 | j                  d       ddz   	 | j                  d       	 | j                  d       | j                  d       | j                  d       y # | j                  d       w xY w# | j                  d       	 | j                  d       | j                  d       n# | j                  d       w xY w| j                  d       w xY w)NrJ   r>   r   rd   r/  r   rq  r  r  s    r   test_jump_in_nested_finally_3z*JumpTestCase.test_jump_in_nested_finally_3c  s    
	MM!aCMM!"a b!MM" b!	 MM!"a b!b!MM"s.   A5 A A25CB+C+B>>Cz"comes after the current code blockc                     	 | j                  d       | j                  d       | j                  d       y # | j                  d       | j                  d        Y y xY wNrJ   rU   rN   r  r  s    r   5test_no_jump_over_return_try_finally_in_finally_blockzBJumpTestCase.test_no_jump_over_return_try_finally_in_finally_blockr  sM    
	MM!MM!MM! MM!MM!	   6 $Aafterc                 J    | j                  d       	 | j                  d       r  r  r  s    r    test_no_jump_infinite_while_loopz-JumpTestCase.test_no_jump_infinite_while_loop  s"    aMM! r   c                 n    d}| j                  d       |dk  r| j                  d       |dz  }|dk  ry y )Nr>   rJ   rU   r  r   r   s     r   #test_jump_forwards_into_while_blockz0JumpTestCase.test_jump_forwards_into_while_block  s8    a1fMM!FA 1fr   )rL   rL   rL   rN   c                 l    d}|dk  r| j                  d       |dz  }|dk  r| j                  d       y )Nr>   rJ   rL   rN   r  r  s     r   $test_jump_backwards_into_while_blockz1JumpTestCase.test_jump_backwards_into_while_block  s:    1fMM!FA 1f 	ar   c                     t        | d      5  | j                  d       d d d        | j                  d       y # 1 sw Y   xY wr  r	   r   r  s    r   $test_jump_forwards_out_of_with_blockz1JumpTestCase.test_jump_forwards_out_of_with_block  9    &!$ 	MM!	a	 		   9Ac                    K   t        | d      4 d {    | j                  d       d d d       d {    | j                  d       y 7 77 # 1 d {  7  sw Y   (xY wwr  r$   r   r  s    r   *test_jump_forwards_out_of_async_with_blockz7JumpTestCase.test_jump_forwards_out_of_async_with_block  W     $VQ/ 	 	MM!	 	a	 	 	 	 	A   A$AA$AA$AA$A$A!AA!A$)r>   rJ   r>   rJ   rL   rr   c                     | j                  d       t        | d      5  | j                  d       d d d        y # 1 sw Y   y xY wr  r   r	   r  s    r   %test_jump_backwards_out_of_with_blockz2JumpTestCase.test_jump_backwards_out_of_with_block  9    a&!$ 	MM!	 	 		   9Ac                    K   | j                  d       t        | d      4 d {    | j                  d       d d d       d {    y 7 &7 # 1 d {  7  sw Y   y xY wwr  r   r$   r  s    r   +test_jump_backwards_out_of_async_with_blockz8JumpTestCase.test_jump_backwards_out_of_async_with_block  W     a$VQ/ 	 	MM!	 	 	 	 	 	 	C   "A$AA$AA$AA$A$A!AA!A$c                     	 | j                  d       | j                  d       | j                  d       y # | j                  d       w xY wr  r  r  s    r   +test_jump_forwards_out_of_try_finally_blockz8JumpTestCase.test_jump_forwards_out_of_try_finally_block  ;    	MM!MM!a MM!	   6 A	)r>   r>   rL   rN   c                     | j                  d       	 | j                  d       | j                  d       y # | j                  d       w xY wNr>   rL   rN   r  r  s    r   ,test_jump_backwards_out_of_try_finally_blockz9JumpTestCase.test_jump_backwards_out_of_try_finally_block  8    a	MM!MM!FMM!	   6 A	c                 x    	 | j                  d       | j                  d       y #  | j                  d        xY wNrJ   rU   rd   r  r  s    r   *test_jump_forwards_out_of_try_except_blockz7JumpTestCase.test_jump_forwards_out_of_try_except_block  7    	MM! 	a	MM!   % 9)r>   r>   rL   c                 x    | j                  d       	 | j                  d       y #  | j                  d        xY wr4  r  r  s    r   +test_jump_backwards_out_of_try_except_blockz8JumpTestCase.test_jump_backwards_out_of_try_except_block  5    a	MM!	MM!   % 9)rU   rW   r/  c                     	 ddz   | j                  d       y # t         $ r% | j                  d       | j                  d       Y ?t        $ r | j                  d       Y Zw xY wNr>   r   rU   rN   rW   r/  r  r   FloatingPointErrorr  s    r   test_jump_between_except_blocksz,JumpTestCase.test_jump_between_except_blocks  sY    	aC 	a ! 	MM!MM!! 	MM!	s    +A"A"!A"c                     	 ddz   | j                  d       | j                  d       y # t         $ r% | j                  d       | j                  d       Y Pw xY w# | j                  d       w xY wrB  )r  r   r  s    r    test_jump_from_except_to_finallyz-JumpTestCase.test_jump_from_except_to_finally  s`    	aC
 MM!a ! 	MM!MM!	 MM!s!   * +AA AA A.)rU   rd   rW   c                     	 ddz   | j                  d       y #  | j                  d       | j                  d       | j                  d       Y IxY w)Nr>   r   rU   rN   rd   rW   r  r  s    r   test_jump_within_except_blockz*JumpTestCase.test_jump_within_except_block  sG    	aC
 	a		MM!MM!MM!s	    5A)r>   rN   r>   rN   c                     | j                  d       	 ddz   d}y # t        $ r}| j                  d       Y d }~d}y d }~ww xY w)Nr>   r   rN   rJ  r   r  )r   r   r,   s      r   test_jump_over_try_exceptz&JumpTestCase.test_jump_over_try_except  sG    a	E  ! 	MM!	s    	A<A)r>   rU   rN   r   c                     | j                  d       t        | d      5  | j                  d       d d d        t        | d      5  | j                  d       d d d        y # 1 sw Y   0xY w# 1 sw Y   y xY wNr>   rJ   rL   rU   rN   r&  r  s    r   test_jump_across_withz"JumpTestCase.test_jump_across_with  i    a&!$ 	MM!	&!$ 	MM!	 		 		 	   AA+A(+A4c                 j  K   | j                  d       t        | d      4 d {    | j                  d       d d d       d {    t        | d      4 d {    | j                  d       d d d       d {    y 7 \7 =# 1 d {  7  sw Y   MxY w7 ?7  # 1 d {  7  sw Y   y xY wwrN  r+  r  s    r   test_jump_across_async_withz(JumpTestCase.test_jump_across_async_with	       a$VQ/ 	 	MM!	 	$VQ/ 	 	MM!	 	 		 	 	 	 		 	 	 	 	   "B3BB3BB3BB3BB3B0B3;B<B3B3BBBB3B3B0$B'%B0,B3)r>   rL   rN   rd   c                     | j                  d       dD ]9  }t        | d      5  | j                  d       d d d        | j                  d       ; | j                  d       y # 1 sw Y   .xY wNr>   r   rL   rU   rN   rd   r&  r  s     r   ,test_jump_out_of_with_block_within_for_blockz9JumpTestCase.test_jump_out_of_with_block_within_for_block	  sb    a 	Afa( !a !MM!	 	a! !s   A""A+	c                   K   | j                  d       dD ]I  }t        | d      4 d {    | j                  d       d d d       d {    | j                  d       K | j                  d       y 7 J7 +# 1 d {  7  sw Y   ;xY wwrW  r+  r  s     r   2test_jump_out_of_async_with_block_within_for_blockz?JumpTestCase.test_jump_out_of_async_with_block_within_for_block	  s     a 	A(3 ! !a ! !MM!	 	a! ! ! ! !sC   'BA4BA8B
A6*B6B8B
	>B?B
	B)r>   rJ   rL   rN   rr   rd   c                    | j                  d       t        | d      5  t        | d      5  | j                  d       d d d        | j                  d       d d d        | j                  d       y # 1 sw Y   4xY w# 1 sw Y   'xY wNr>   rJ   rL   rU   rN   rd   r&  r  s    r   -test_jump_out_of_with_block_within_with_blockz:JumpTestCase.test_jump_out_of_with_block_within_with_block	  sr    a&!$ 	fa( !a !MM!	 	a! !	 	s!   A<A0A<0A9	5A<<Bc                 R  K   | j                  d       t        | d      5  t        | d      4 d {    | j                  d       d d d       d {    | j                  d       d d d        | j                  d       y 7 P7 1# 1 d {  7  sw Y   AxY w# 1 sw Y   4xY wwr\  )r   r	   r$   r  s    r   3test_jump_out_of_async_with_block_within_with_blockz@JumpTestCase.test_jump_out_of_async_with_block_within_with_block&	  s     a&!$ 	(3 ! !a ! !MM!	 	a! ! ! ! !	 	sa   B'BBBBBBB(B'BBB	BB	BB$ B')rJ   rU   rd   rW   c                 b   	 | j                  d       t        | d      5  | j                  d       d d d        | j                  d       | j                  d       y # 1 sw Y   ,xY w# t        | d      5  | j                  d       d d d        n# 1 sw Y   nxY w| j                  d       w xY wNrJ   rU   rN   rd   rW   r&  r  s    r   0test_jump_out_of_with_block_within_finally_blockz=JumpTestCase.test_jump_out_of_with_block_within_finally_block/	  s    	MM!fa( !a !MM!a! !fa( !a ! ! !MM!s.   A( AA%(B.5B	B.BB.c           	        K   	 | j                  d       t        | d      4 d {    | j                  d       d d d       d {    | j                  d       | j                  d       y 7 H7 )# 1 d {  7  sw Y   9xY w# t        | d      4 d {  7   | j                  d       d d d       d {  7   n# 1 d {  7  sw Y   nxY w| j                  d       w xY wwra  r+  r  s    r   6test_jump_out_of_async_with_block_within_finally_blockzCJumpTestCase.test_jump_out_of_async_with_block_within_finally_block9	  s     	MM!(3 ! !a ! !MM!a! ! ! ! !(3 ! !a ! ! ! ! !MM!s   C+B C+A.C+A2C+A0(C+0C+2B8A;9B C+C(B
C(C/C(:B=;C(CC
CC((C+r/  )r>   rL   rN   rq  rz  c                 L   | j                  d       dD ]g  }| j                  d       dD ]>  }| j                  d       	 dD ]  }| j                  d        	 | j                  d       @ | j                  d       i | j                  d	       y # | j                  d       w xY w)
Nr>   r   rL   r  rN   r/  r   rq  rz  r  )r   r   r~  ks       r   &test_jump_out_of_complex_nested_blocksz3JumpTestCase.test_jump_out_of_complex_nested_blocksC	  s    a 		AMM! &a &# )a() MM"%& MM"		 	b MM"%s   BB#)r>   rJ   rN   c                     | j                  d       t        | d      5 }| j                  d       d d d        | j                  d       y # 1 sw Y   xY wNr>   rJ   rU   rN   r&  r  s     r    test_jump_out_of_with_assignmentz-JumpTestCase.test_jump_out_of_with_assignmentR	  sJ    a&!$ 	MM!	 	a	 	s   A

Ac                    K   | j                  d       t        | d      4 d {   }| j                  d       d d d       d {    | j                  d       y 7 77 # 1 d {  7  sw Y   (xY wwri  r+  r  s     r   &test_jump_out_of_async_with_assignmentz3JumpTestCase.test_jump_out_of_async_with_assignmentZ	  sh     a$VQ/ 	 	MM!	 	 	a	 	 	 	 	sC   "A5AA5A A5AA5A5 A2&A)'A2.A5)r>   rd   r/  r1  c                    | j                  d       	 | j                  d       | s	 | j                  d       y | j                  d       | j                  d       | j                  d       y # | j                  d       w xY w)Nr>   rL   r/  rd   r1  r  r  s    r   *test_jump_over_return_in_try_finally_blockz7JumpTestCase.test_jump_over_return_in_try_finally_blockb	  si    a	MM! MM! MM!MM!a MM!s   A- A- -B )r>   rL   r/  r   rq  r  c                 N   | j                  d       	 | j                  d       	 | j                  d       | s	 | j                  d       n4| j                  d       | j                  d       | j                  d       	 | j                  d       y # | j                  d       w xY w)Nr>   rL   rN   r   r/  rq  r  r  r  s    r   )test_jump_over_break_in_try_finally_blockz6JumpTestCase.test_jump_over_break_in_try_finally_blockn	  s    aMM!"a  b! a b!MM"b b!s   B B B$c                     | j                  d       | sdD ]  }| j                  d        n"| j                  d       | j                  d       | j                  d       y Nr>   r  rU   rd   rW   r/  r  r  s     r   $test_jump_over_for_block_before_elsez1JumpTestCase.test_jump_over_for_block_before_else~	  R    a !a ! MM!MM!ar   c                    K   | j                  d       | s't        dg      2 3 d {   }| j                  d       | j                  d       | j                  d       | j                  d       y 7 J6 wNr>   rL   rU   rd   rW   r/  r   r-   r  s     r   *test_jump_over_async_for_block_before_elsez7JumpTestCase.test_jump_over_async_for_block_before_else	  b     a$aS> ! !aa MM!MM!a!>&    A5A3A1A3AA51A33A5c                 H    | j                  d       | j                  d       y r^   r  r  s    r   test_no_jump_too_far_forwardsz*JumpTestCase.test_no_jump_too_far_forwards	  r  r   rr   beforec                 H    | j                  d       | j                  d       y r^   r  r  s    r   test_no_jump_too_far_backwardsz+JumpTestCase.test_no_jump_too_far_backwards	  r  r   exceptc                 V    	 | j                  d       y #  | j                  d        xY wNrJ   rU   r  r  s    r   test_no_jump_to_except_1z%JumpTestCase.test_no_jump_to_except_1	  s)    	MM!	MM!s    (c                 f    	 | j                  d       y # t        $ r | j                  d        w xY wr  r   r  r  s    r   test_no_jump_to_except_2z%JumpTestCase.test_no_jump_to_except_2	  s1    	MM! 	MM!	s    0c                 p    	 | j                  d       y # t        $ r}| j                  d       |d }~ww xY wr  r  r  s     r   test_no_jump_to_except_3z%JumpTestCase.test_no_jump_to_except_3	  s4    	MM! 	MM!G	s    	505c                 |    	 | j                  d       y # t        t        f$ r}| j                  d       |d }~ww xY wr  )r   r  r   r  s     r   test_no_jump_to_except_4z%JumpTestCase.test_no_jump_to_except_4	  s9    	MM!L) 	MM!G	s    ;6;intoc                 V    | j                  d       dD ]  }| j                  d        y )Nr>   r  rL   r  r  s     r   $test_no_jump_forwards_into_for_blockz1JumpTestCase.test_no_jump_forwards_into_for_block	  s)    a 	AMM!	r   c                    K   | j                  d       t        ddg      2 3 d {   }| j                  d       7 6 y wr  rw  r  s     r   *test_no_jump_forwards_into_async_for_blockz7JumpTestCase.test_no_jump_forwards_into_async_for_block	  sB     a !Q( 	 	!MM!	(s   A ><>A >A c                 V    dD ]  }| j                  d        | j                  d       y )Nr  rJ   rL   r  r  s     r   %test_no_jump_backwards_into_for_blockz2JumpTestCase.test_no_jump_backwards_into_for_block	  s)     	AMM!	ar   z&can't jump into the body of a for loopc                    K   t        ddg      2 3 d {   }| j                  d       7 6 | j                  d       y wr  )r-   r   r  s     r   +test_no_jump_backwards_into_async_for_blockz8JumpTestCase.test_no_jump_backwards_into_async_for_block	  s?      !Q( 	 	!MM!	(as   A -+-A -A r  c                     | j                  d       t        | d      5  | j                  d       d d d        y # 1 sw Y   y xY wr  r&  r  s    r   %test_no_jump_forwards_into_with_blockz2JumpTestCase.test_no_jump_forwards_into_with_block	  r(  r)  c                    K   | j                  d       t        | d      4 d {    | j                  d       d d d       d {    y 7 &7 # 1 d {  7  sw Y   y xY wwr  r+  r  s    r   +test_no_jump_forwards_into_async_with_blockz8JumpTestCase.test_no_jump_forwards_into_async_with_block	  r-  r.  )r>   rJ   r   c                     t        | d      5  | j                  d       d d d        | j                  d       y # 1 sw Y   xY wr  r  r  s    r   &test_no_jump_backwards_into_with_blockz3JumpTestCase.test_no_jump_backwards_into_with_block	  r  r  c                    K   t        | d      4 d {    | j                  d       d d d       d {    | j                  d       y 7 77 # 1 d {  7  sw Y   (xY wwr  r!  r  s    r   ,test_no_jump_backwards_into_async_with_blockz9JumpTestCase.test_no_jump_backwards_into_async_with_block	  r#  r$  c                     | j                  d       	 | j                  d       | j                  d       y # | j                  d       w xY wr4  r  r  s    r   )test_jump_forwards_into_try_finally_blockz6JumpTestCase.test_jump_forwards_into_try_finally_block	  r6  r7  )rJ   rU   rJ   rU   rN   c                     	 | j                  d       | j                  d       | j                  d       y # | j                  d       w xY wr  r  r  s    r   *test_jump_backwards_into_try_finally_blockz7JumpTestCase.test_jump_backwards_into_try_finally_block	  r1  r2  c                 x    | j                  d       	 | j                  d       y #  | j                  d        xY wr4  r  r  s    r   (test_jump_forwards_into_try_except_blockz5JumpTestCase.test_jump_forwards_into_try_except_block
  r?  r@  )rJ   rJ   rd   c                 x    	 | j                  d       | j                  d       y #  | j                  d        xY wr9  r  r  s    r   )test_jump_backwards_into_try_except_blockz6JumpTestCase.test_jump_backwards_into_try_except_block
  r;  r<  c                     	 ddz   | j                  d       y # t         $ r% | j                  d       | j                  d       Y ?t        $ r}| j                  d       Y d }~]d }~ww xY wrB  rC  r  s     r   !test_jump_between_except_blocks_2z.JumpTestCase.test_jump_between_except_blocks_2
  s]    	aC 	a ! 	MM!MM!! 	MM!	s    +A)A)A$$A)c                     | j                  d       	 | j                  d       | j                  d       y # | j                  d       w xY wr4  r  r  s    r   test_jump_into_finally_blockz)JumpTestCase.test_jump_into_finally_block!
  r6  r7  )rJ   rd   rW   c                     	 | j                  d       | j                  d       | j                  d       | j                  d       | j                  d       y # | j                  d       | j                  d       w xY w)NrJ   rL   rN   rd   rW   r  r  s    r   +test_jump_into_finally_block_from_try_blockz8JumpTestCase.test_jump_into_finally_block_from_try_block)
  s_    	MM!MM!MM!MM!a MM!MM!s   "A $A<)r>   rL   r>   rL   rN   c                     | j                  d       	 | j                  d       | j                  d       y # | j                  d       w xY wr4  r  r  s    r   test_jump_out_of_finally_blockz+JumpTestCase.test_jump_out_of_finally_block3
  r6  r7  z9can't jump into an 'except' block as there's no exceptionc                 z    | j                  d       	 | j                  d       y #  | j                  d       Y y xY wr4  r  r  s    r   #test_no_jump_into_bare_except_blockz0JumpTestCase.test_no_jump_into_bare_except_block;
  s2    a	MM!	MM!s   % :c                     | j                  d       	 | j                  d       y # t        $ r | j                  d       Y y w xY wr4  r   rv   r  s    r   (test_no_jump_into_qualified_except_blockz5JumpTestCase.test_no_jump_into_qualified_except_blockC
  s:    a	MM! 	MM!	s   % AA)rJ   rN   rd   c                     	 | j                  d       | j                  d       | j                  d       y #  | j                  d       | j                  d        xY wNrJ   rL   rN   rd   r/  r  r  s    r   2test_no_jump_into_bare_except_block_from_try_blockz?JumpTestCase.test_no_jump_into_bare_except_block_from_try_blockK
  sO    	MM!MM!
 	a		MM!MM!s	   "6 %Ac                     	 | j                  d       | j                  d       | j                  d       y # t        $ r$ | j                  d       | j                  d        w xY wr  rK  r  s    r   7test_no_jump_into_qualified_except_block_from_try_blockzDJumpTestCase.test_no_jump_into_qualified_except_block_from_try_blockV
  sY    	MM!MM!
 	a	 ! 	MM!MM!	s	   "6 -A#)r>   rL   rd   r>   rL   rd   rW   c                     | j                  d       	 | j                  d       ddz   y #  | j                  d       | j                  d       Y y xY wNr>   rL   r   rd   rW   r  r  s    r   "test_jump_out_of_bare_except_blockz/JumpTestCase.test_jump_out_of_bare_except_blocka
  sE    a	MM!aC	MM!MM!s	   * $Ac                     | j                  d       	 | j                  d       ddz   y # t        $ r% | j                  d       | j                  d       Y y w xY wr  r  r  s    r   'test_jump_out_of_qualified_except_blockz4JumpTestCase.test_jump_out_of_qualified_except_blockk
  sM    a	MM!aC 	MM!MM!	s   * +AA)r>   rJ   rN   rr   c                     | j                  d       t        | d      5  | j                  d       d d d        t        | d      5  | j                  d       d d d        y # 1 sw Y   0xY w# 1 sw Y   y xY wrN  r&  r  s    r   test_jump_between_with_blocksz*JumpTestCase.test_jump_between_with_blocksu
  rP  rQ  c                 j  K   | j                  d       t        | d      4 d {    | j                  d       d d d       d {    t        | d      4 d {    | j                  d       d d d       d {    y 7 \7 =# 1 d {  7  sw Y   MxY w7 ?7  # 1 d {  7  sw Y   y xY wwrN  r+  r  s    r   #test_jump_between_async_with_blocksz0JumpTestCase.test_jump_between_async_with_blocks}
  rT  rU  c                     	 | j                  d       | j                  d       | j                  d       y # | j                  d       | j                  d        Y y xY wr  r  r  s    r   -test_no_jump_over_return_out_of_finally_blockz:JumpTestCase.test_no_jump_over_return_out_of_finally_block
  sM    	MM!MM!MM! MM!MM!r  c                     | j                  d       | sdD ]  }| j                  d        n"| j                  d       | j                  d       | j                  d       y rr  r  r  s     r   'test_no_jump_into_for_block_before_elsez4JumpTestCase.test_no_jump_into_for_block_before_else
  rt  r   c                    K   | j                  d       | s't        dg      2 3 d {   }| j                  d       | j                  d       | j                  d       | j                  d       y 7 J6 wrv  rw  r  s     r   -test_no_jump_into_async_for_block_before_elsez:JumpTestCase.test_no_jump_into_async_for_block_before_else
  ry  rz  c                 6    | j                  t        dddg       y )NrJ   SpamT)r   r  r   s    r   test_no_jump_to_non_integersz)JumpTestCase.test_no_jump_to_non_integers
  s    -q&4&Ar   c                     t                y r   )r  r   s    r   #test_no_jump_without_trace_functionz0JumpTestCase.test_no_jump_without_trace_function
  s
     	'(r   c                 ~    i }t        ddz  |       |d   }| j                  |dddgt        | j                  f       y )Na  def f(output):        # line 0
            x = 0                     # line 1
            y = 1                     # line 2
            '''                       # line 3
            %s                        # lines 4-1004
            '''                       # line 1005
            x += 1                    # line 1006
            output.append(x)          # line 1007
            return)a  







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































r!  rJ   i  r   r  )r$  r   RuntimeWarningunbound_locals)r   r  r!  s      r   test_large_functionz JumpTestCase.test_large_function
  sQ      '' )*	+ cFaD1#@S@S/TUr   c                    t        ddd       G fdd      }t        |dd      }t        j                  |j                         dg i}t        |       t        j                  d        | j                  g d	|d          y )
Nzd
# Comments don't count.
output.append(2)  # firstlineno is here.
output.append(3)
output.append(4)
z<fake module>r$  c                       e Zd ZW  Zy)<JumpTestCase.test_jump_to_firstlineno.<locals>.fake_functionN)r   r   r    r   )r  s   r   fake_functionr  
  s    Hr   r  rU   r>   r   )rJ   rL   rJ   rL   rU   )compiler  r~   r   r   r$  r  )r   r  r   r%  r  s       @r   test_jump_to_firstlinenoz%JumpTestCase.test_jump_to_firstlineno
  sw      
 f	 	M1a0V\\"rN	T9T  )H2EFr   rA   z5can't jump from the 'call' trace event of a new frame)r   r  c                 b      j                  d        fd} |         j                  d       y )Nr>   c                  (     j                  d       y r  r  r  s   r   nestedz3JumpTestCase.test_no_jump_from_call.<locals>.nested
  s    MM!r   rN   r  )r   r  s   ` r   test_no_jump_from_callz#JumpTestCase.test_no_jump_from_call
  s'     	a	ar   rE   z'can only jump from a 'line' trace eventc                 &    | j                  d       y r=   r  r  s    r   test_no_jump_from_return_eventz+JumpTestCase.test_no_jump_from_return_event
  s     	ar   r{   c                 0    | j                  d       ddz   y r  r  r  s    r   !test_no_jump_from_exception_eventz.JumpTestCase.test_no_jump_from_exception_event
  s     	a	Ar   )r   c                 R      fd}t         |               j                  d       y )Nc               3   8   K    j                  d       d y w)NrJ   rL   r  r  s   r   rF  z.JumpTestCase.test_jump_from_yield.<locals>.gen
  s     MM!Gs   rN   )rC  r   )r   rF  s   ` r   test_jump_from_yieldz!JumpTestCase.test_jump_from_yield
  s    	 	SUar   c                     | j                  d       t        d      D cg c]  }| }}| j                  d       y c c}w Nr>   r   rL   r   r`   r   r   r,   s      r   test_jump_forward_over_listcompz,JumpTestCase.test_jump_forward_over_listcomp
  s6    ab	"1Q""a #s   	<c                 F    d}t        d      D cg c]  }| }}d}y c c}w r  r_   r   ra   r   r,   r  s        r    test_jump_backward_over_listcompz-JumpTestCase.test_jump_backward_over_listcomp
  s(    b	"1Q"" #s   	)rJ   rW   rJ   c                     d}| j                  d       |ry t        d      D cg c]  }| }}d}| j                  d       | j                  d       y c c}w NFrJ   rN   rd   rW   r/  r  r   flagr   r,   s       r   #test_jump_backward_over_listcomp_v2z0JumpTestCase.test_jump_backward_over_listcomp_v2
  sR    aa!1Q!!aa "s   	Ac                    K   | j                  d       t        t        d            2 cg c3 d {   }|7 6 nc c}w }}| j                  d       y wr  r   r-   r`   r  s      r   %test_jump_forward_over_async_listcompz2JumpTestCase.test_jump_forward_over_async_listcomp  sD     a'b	233Q3333as&   (A<:8
:<:<Ac                 r   K   d}t        t        d            2 cg c3 d {   }|7 6 nc c}w }}d}y wr  )r-   r`   r  s        r   &test_jump_backward_over_async_listcompz3JumpTestCase.test_jump_backward_over_async_listcomp
  s6     'b	233Q3333s$   7-+)
+-+-7c                    K   d}| j                  d       |ry t        t        d            2 cg c3 d {   }|7 6 nc c}w }}d}| j                  d       | j                  d       y wr  r  r  s       r   )test_jump_backward_over_async_listcomp_v2z6JumpTestCase.test_jump_backward_over_async_listcomp_v2  s`     a'a122Q2222aas*   -A-A?=
?A?A -A-)r  c                     d}t        | j                  d             | j                  d       |dz   dz    | j                  d       y Nr>   rL   rN   r   r  r&  r  r   r   ra   s     r   (test_jump_with_null_on_stack_load_globalz5JumpTestCase.test_jump_with_null_on_stack_load_global  sN    MM!	
 	a 
  	br   c                     d}t         } || j                  d             | j                  d       |dz   dz    | j                  d       y )Nr>   rU   rd   rq  rs     r  )r   ra   r!  s      r   &test_jump_with_null_on_stack_push_nullz3JumpTestCase.test_jump_with_null_on_stack_push_null/  sS    	MM!	
 	a 
  	br   c                     d}t         j                  | d       | j                  d       |dz   dz    | j                  d       y r  )listr   r  s     r   &test_jump_with_null_on_stack_load_attrz3JumpTestCase.test_jump_with_null_on_stack_load_attrC  sK    A	
 	a 
  	br   c                 z    | j                  d       | j                  d      xs d^}}}| j                  d       y Nr>   rJ   r  rL   r  r   rH  s     r   (test_jump_extended_args_unpack_ex_simplez5JumpTestCase.test_jump_extended_args_unpack_ex_simpleU  s3    a==#-vAqar   )r>   rU   rU   rN   c                 z    | j                  d       | j                  d      xs d^}}}| j                  d       y )Nr>   rU   r  rN   r  r   s     r   (test_jump_extended_args_unpack_ex_trickyz5JumpTestCase.test_jump_extended_args_unpack_ex_tricky[  s9    a MM!&	
1ar   cpuc                     dddgd t        dd      D        d}i }t        dj                  |      |       |d	   }| j                  |d
dddgt        | j
                  f       y )Nzdef f(output):z    output.append(1)z    for _ in spam:c              3   (   K   | ]
  }d | d  yw)z        output.append()Nr"   r   r   s     r   r   z@JumpTestCase.test_jump_extended_args_for_iter.<locals>.<genexpr>k  s     G&qc+G   rL   i z    output.append(100_000)r   r!  rJ   r>   r  )r`   r$  r   r   r  r  )r   sourcer%  r!  s       r    test_jump_extended_args_for_iterz-JumpTestCase.test_jump_extended_args_for_iterc  s}    
 " 
 HU1g5FG	

 )
 	TYYv	*cNa!Wq'l^TM`M`<abr   c                 r    | j                  d       | j                  d      xr d}| j                  d       y r  r  r   s     r   test_jump_or_popzJumpTestCase.test_jump_or_pops  s-    aMM!'ar   )NrC   FN)NrC   N)tr   r   r    r  r   r  r   r  r  r  r  r  r  r  r  r  r  r  r  r;   r  r  r  r  r	  r  r  r  r  r  r  r  r  r  r"  r'  r,  r0  r5  r:  r>  rE  rG  rI  rL  rO  rS  rX  rZ  r]  r_  rb  rd  rg  rj  rl  rn  rp  rs  rx  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   requires_resourcer  r  r"   r   r   r  r    sV   >N6 @D8<3. FJ8<3*

 q!aS 
 q!Y   q!aS>>"BC D q!Y   q!aS  q!Y   q!aVnn%EF G q!-. / QAq6"  # Q-.  / q!aS 
 q!Y   q!aV	 	 q!aV/45 6 q"q"g 1267 8 q"q!fz+OPQ R q!aS:w/0 1 q!aV  q!\" # q!aV 
 QAq6" #
 q!() *
 Q./ 0
 q!aS  q!\" # q!aS  q!Y   q!Y   q!Y   q!Y   q!\NN+KL M q!]# $ Q=) * q!\" # Q<( ) q!() * Q./ 0 q!\" # Q<( ) q"'( ) q!Y(HI J Q9~~.NO P q!\"	 #	 q!*+ , q!aVnn%EF G QAq6NN+KL M q!aS:w/0 1 q"qcJ12 3
 q!aS:x01 2 q!aS:x01 2 q!aS:x01 2 q!aS:x01 2 q!R*f-. /
 Q2
F34 5 q!aVj&12 3 QAq6J0X#YZ [
 q!R*g./ 0
 Q2
G45 6
 q!Z*g!67 8
 Q:
G'<= >
 q!aV  q!_% & q!aS  q!Y   q!Y(HI J q!aS  q!Y   q!_% & q!R*&abc d q!R*&abc d q!Y-h ij k q!aS:'bcd e q!*+ , q!*+ , q!]# $ Q=) * q!aVj'23 4 q!aVj&12 3 QAq6J#78 9B)
VG& q!aSz <8 /9 :: q!aS81: ;; q!aSJ84: ;; q!aV8, - q!aVnn%EF G q!R..!AB C
 q!Y(HI J QAq6NN+KL M
 Q2'GH I
 Q9~~.NO P q!R
G45 6$ q!R
G45 6& q!R
G45 6" q!aVnn%EF G
 q!\NN+KL M Wu%c &c q!aVnn%EF Gr   r  c                   $    e Zd Zd Zd Zd Zd Zy)TestExtendedArgsc                     | j                  t        j                  t        j                                t        j                  d        y r   r}  r   s    r   r   zTestExtendedArgs.setUp|  r  r   c                     t        d      D ]	  } |         ddddfdt        j                          |        t        j                  d        S )N   r   rA   rC   rE   c                 "    |xx   dz  cc<   S r=   r"   )r   r   r   countsr   s      r   r   z,TestExtendedArgs.count_traces.<locals>.trace  s    5MQMLr   )r`   r~   r   )r   r   rH  r  r   s      @@r   count_traceszTestExtendedArgs.count_traces  sR    r 	AF	 Q!4	 	UTr   c                 x    i }d}t        ||       | j                  |d         }| j                  |dddd       y )Na"  def f():
  (y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   y,
   ) = range(300)r!  r>   i-  r  )r$  r  rL  )r   nsr  r  s       r   test_trace_unpack_long_sequencez0TestExtendedArgs.test_trace_unpack_long_sequence  s@    AT2""2c7+!SA!FGr   c                 d   t        dt        t        j                  dz              }dj	                  dj                  d t        |      D                    }t        |      D ci c]  }d| |
 }}t        ||       | j                  |d         }| j                  |d|d	z  dd
       y c c}w )Ni  g?zeif 1:
            def f():
                return (
                    {}
                )
        z
+
c              3   (   K   | ]
  }d | d  yw)varr   Nr"   r  s     r   r   z>TestExtendedArgs.test_trace_lots_of_globals.<locals>.<genexpr>  s     B#aSBr	  r  r!  r>   rJ   r  )
minintr   C_RECURSION_LIMITformatr   r`   r$  r  rL  )r   r^  r  r   r  r  s         r   test_trace_lots_of_globalsz+TestExtendedArgs.test_trace_lots_of_globals  s    D#g77#=>?
 F7<<BU5\BBC 	 %*%L1qA3il11T2""2c7+!UQY!!LM 2s   $B-N)r   r   r    r   r  r  r"  r"   r   r   r  r  z  s     HNr   r  c                       e Zd Zd Zd Zd Zy)TestEdgeCasesc                     | j                  t        j                  t        j                                t        j                  d        y r   r}  r   s    r   r   zTestEdgeCases.setUp  r  r   c                     d }d  G fdd      }t        j                   |              t        j                  |       | j                  t        j                                y )Nc                       y r   r"   r   s    r   r  z*TestEdgeCases.test_reentrancy.<locals>.foo      r   c                       y r   r"   r   s    r   barz*TestEdgeCases.test_reentrancy.<locals>.bar  r(  r   c                       e Zd Zd Z fdZy)(TestEdgeCases.test_reentrancy.<locals>.Ac                      y r   r"   )r   r7   s     r   __call__z1TestEdgeCases.test_reentrancy.<locals>.A.__call__  r  r   c                 0    t        j                         y r   )r~   r   )r   r*  s    r   __del__z0TestEdgeCases.test_reentrancy.<locals>.A.__del__  s    S!r   N)r   r   r    r.  r0  )r*  s   r   r  r,    s    "r   r  )r~   r   rL  r   )r   r  r  r*  s      @r   test_reentrancyzTestEdgeCases.test_reentrancy  sI    			" 	" 	QSS-r   c                     d }t        j                  |       ~t        j                  t        j                                y )Nc                       y r   r"   r   s    r   r  z+TestEdgeCases.test_same_object.<locals>.foo  r(  r   r   )r   r  s     r   test_same_objectzTestEdgeCases.test_same_object  s*    	 	SS\\^$r   N)r   r   r    r   r1  r4  r"   r   r   r$  r$    s    .&%r   r$  c                       e Zd Zd Zy)TestLinesAfterTraceStartedc                 P   t               }|j                  t        j                         _        t        j
                  |j                         d}d}t        j
                  d        | j                  t        j                  j                  j                  |j                  g d       y )NrU   rN   )rT   rM   rc   )r   r   r~   r   r   r   r   r6  test_eventsr   r   r   )r   r   rC   s      r   r8  z&TestLinesAfterTraceStarted.test_events  sp    "(,,V\\"T&22;;JJMM 	r   N)r   r   r    r8  r"   r   r   r6  r6    s    r   r6  c                       e Zd Zd Zy)TestSetLocalTracec                     fddd}g d}g t        j                         t        j                         _         |        | j	                  |       t        j                  d        y )Nc                     | j                   j                  dk(  r=| _        | j                  | j                   j                  z
  }j                  ||f       S )Nr   )r[  r\  r   r   r   r   )r   r   r   rC   r   r   s       r   r   z7TestSetLocalTrace.test_with_branches.<locals>.tracefunc  sJ    ||##v- )~~(C(CCtUm,r   c                 8    d}| dk\  rd}nd}| dk\  rd}d}y d}d}y )Nr>   rJ   rL   rN   rW   r1  r   r"   )r   Nnot_reachedreachedthe_ends        r   r   z2TestSetLocalTrace.test_with_branches.<locals>.func  s7    Aaxax G Gr   )r@   rB   rI   rM   rc   r0  ro  r  r   )r~   r   r   r   rL  )r   r   rM  r   r   s      @@r   test_with_branchesz$TestSetLocalTrace.test_with_branches  sV    	
		
 Y"+1Tr   N)r   r   r    rB  r"   r   r   r:  r:    s    %r   r:  __main__)9r9   r   unittestr~   r   r   	functoolsr   r  test.supportr   r  r  requires_working_socketr	   r$   r-   r;   r?   r   rH   rQ   rS   rZ   rb   ri   rm   rA   rw   ry   r   r   r   r   r   r   r   r   r   r   TestCaser   rK  ri  rg  rs  r{  r  r  r  r  r  r$  r6  r:  r   mainr"   r   r   <module>rJ     sc     
  	   &     t ,
( 
(
( 
(
 
' 
' ' 

( 	% 
' 

$
 /$ ,_  ,  ) +  "+  	- )+6;
< )-89   0p1H%% p1f+	/- 	/ 	0= 0 0g3x00 g3\# #L+H]8$$ ]@)Nx(( )NX%H%% %D "' 'T zHMMO r   