
    6\h?                       d dl mZ d dlZd dlm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  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/d0d1gd2z  z   d0d3gz   e&_         G d4 d5          Z' G d6 d7ej(                  Z)g d8Z* G d9 d:e)          Z+ej,         G d; d<e)                      Z- G d= d>ej(                  Z. G d? d@          Z/dA Z0dB Z1 G dC dDej(                  Z2 G dE dFej(                  Z3 G dG dHej(                  Z4e5dIk    r ej6                     dS dS )J    )supportN)	MagicMockwraps)import_helperT)modulec                   "    e Zd Z	 d Zd Zd ZdS )tracecontextc                 "    || _         || _        d S Noutputvalueselfr   r   s      @/opt/python-3.11.14/usr/lib/python3.11/test/test_sys_settrace.py__init__ztracecontext.__init__       


    c                 D    | j                             | j                   d S r   r   appendr   r   s    r   	__enter__ztracecontext.__enter__   s     4:&&&&&r   c                 F    | j                             | j                    d S r   r   r   exc_infos     r   __exit__ztracecontext.__exit__   s"    DJ;'''''r   N)__name__
__module____qualname__r   r   r    r   r   r
   r
      sD        9  ' ' '( ( ( ( (r   r
   c                   "    e Zd Z	 d Zd Zd ZdS )asynctracecontextc                 "    || _         || _        d S r   r   r   s      r   r   zasynctracecontext.__init__   r   r   c                 H   K   | j                             | j                   d S r   r   r   s    r   
__aenter__zasynctracecontext.__aenter__!   s$      4:&&&&&r   c                 J   K   | j                             | j                    d S r   r   r   s     r   	__aexit__zasynctracecontext.__aexit__$   s&      DJ;'''''r   N)r   r    r!   r   r'   r)   r"   r   r   r$   r$      sD        H  ' ' '( ( ( ( (r   r$   c                    K   	 | D ]}|W V  d S r   r"   )iterablexs     r   	asynciterr-   '   s/      :   r   c                 <     t                      fd            }|S )Nc                     K   g fd}	  | i |d|i d {V 	 r%                                               d {V  $S S # r$                                               d {V  $w xY w)Nc                 Z    t          |           }                    |j                   |S r   )r-   r   aclose)r+   itcleanupss     r   wrapped_asynciterz;clean_asynciter.<locals>.wrapper.<locals>.wrapped_asynciter0   s)    8$$BOOBI&&&Ir   r-   pop)argskwargsr4   r3   tests      @r   wrapperz clean_asynciter.<locals>.wrapper-   s      	 	 	 	 		'tKvKK9JKKKKKKKKKK '$hllnn&&&&&&&&&  ' ' '( '$hllnn&&&&&&&&&  ' ' ' ' 's   A (A/r   )r9   r:   s   ` r   clean_asynciterr;   ,   s3    
4[[
' 
' 
' 
' [
' Nr   c                      dS N   r"   r"   r   r   basicr?   <   s    1r   )r   callr>   liner>   returnc                      d} ~ 	 d} d S r=   r"   r,   s    r   arigo_example0rH   K       	A		AAAr   )r@   rB      rC      rC      rC   rO   rE   c                      d} ~ 	 d} d S r=   r"   rG   s    r   arigo_example1rR   Y   rI   r   c                      d} ~ 	 d} d S r=   r"   rG   s    r   arigo_example2rT   g   s    	A	 4r   )r@   rB   rJ   rL      rC      rC   rX   rE   c                      d} ~ d} d S r=   r"   rG   s    r   one_instr_liner[   z   s    	A		AAAr   r@   rB   rJ   rL   rM   rE   c                  <    d} t          d          D ]	}|rd} d} 
d S Nr>   rK   range)r,   as     r   no_pop_topsrc      s<    	A1XX   	AAAA	 r   )
r@   rB   rJ   rL      rC   rJ   rL   rU   rJ   rK   rE   c                  $    d} | s	t            | 	d}d S r=   )bla)yr,   s     r   no_pop_blocksrj      s'    	A   	AAAr   r@   rB   rJ   rU   rV   rE   c                  
    d} d S r=   r"   rG   s    r   calledrn      s    	AAAr   c                  "    t                       d S r   )rn   r"   r   r   rA   rA      s    
HHHHHr   )r@   rB   rA   rC   rs   rE   rD   c                      t           r   	Exceptionr"   r   r   raisesrx      s    
Or   c                  F    	 t                       d S # t          $ r Y d S w xY wr   )rx   rw   r"   r   r   
test_raiserz      s6       s    
  )r@   rB   rJ   rp   rr   rs   	exceptionrt   rK   r|   rL   rU   rl   c                 h    t          j        |            | t          j                    j        _        d S r   )syssettrace	_getframef_backf_trace	tracefuncs    r   _settrace_and_returnr      s)    L%.CMOO"""r   c                 $    t          |            d S r   )r   r   s    r   settrace_and_returnr      s    #####r   rD   c                 r    t          j        |            | t          j                    j        _        t
          r   )r   r   r   r   r   RuntimeErrorr   s    r   _settrace_and_raiser      s)    L%.CMOO"
r   c                 H    	 t          |            d S # t          $ r Y d S w xY wr   )r   r   r   s    r   settrace_and_raiser      s=    I&&&&&   s    
!!)r}   rL   rU   rl   c                  (    d} d}| |k    r| dz   }d S d S )NrO   r>   r"   )rb   bs     r   ireturn_exampler      s'    	A	AAvvaCr   r@   rB   rJ   rL   rU   rl   c                  h    t          dd          } 	 d}	 | |         }|dz  }# t          $ r Y d S w xY w)Nr   rM   r>   ra   
IndexError)itemsir   s      r   tightloop_exampler      sV    !QKKE	aA!Q$!	   s   # 
11)r@   rB   rJ   rL   rU   rN   rU   rN   rU   rN   rU   rN   )rO   r|   rd   rW   rY   c                  \    t          dd          } 	 d}| |         }	# t          $ r Y d S w xY w)Nr>   rV   r   r   )r   r   s     r   tighterloop_exampler     sG    !QKKE1X   s    
++)r@   rB   rJ   rL   rU   rU   rU   rU   )rV   r|   rN   rd   re   rE   c               #       K   	 dV  	 d S # w xY wNTr"   r"   r   r   generator_functionr   $  s%      


					s    c                  d    t          t                                } t          d          D ]} | }d S )N
   )anyr   ra   )r,   ri   s     r   generator_exampler   *  s>      !!A 2YY   r   )
r@   rJ   rA   rC   rC   r   rE   )r   rA   r   r|   rC   r   rE   rN   rd   r   rP   c                   (    e Zd ZddZd Zd Zd ZdS )TracerNc                 0    || _         || _        g | _        d S r   )trace_line_eventstrace_opcode_eventsevents)r   r   r   s      r   r   zTracer.__init__A  s    !2#6 r   c                 V    | j         | j         |_        | j        | j        |_        d S d S r   )r   f_trace_linesr   f_trace_opcodes)r   frames     r   _reconfigure_framezTracer._reconfigure_frameF  s8    !-"&"8E#/$($<E!!! 0/r   c                 |    |                      |           | j                            |j        |f           | j        S r   r   r   r   f_linenotracer   r   eventargs       r   r   zTracer.traceL  s;    &&&ENE2333zr   c                     |                      |           d dD              | j                            |j        |f           | j        S )Nc              3      K   | ]}|V  d S r   r"   ).0os     r   	<genexpr>z)Tracer.traceWithGenexp.<locals>.<genexpr>S  s"      qr   r>   r   r   s       r   traceWithGenexpzTracer.traceWithGenexpQ  sO    &&&CENE2333zr   )NN)r   r    r!   r   r   r   r   r"   r   r   r   r   @  sU           
= = =  
    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 ZFeGjH        dD             ZIdE ZJeGjH        dF             ZKdG ZLdHS )ITraceTestCasec                     t          j                    | _        t          j                     |                     t
          j        t          j                               d S r   )gc	isenabledusing_gcdisable
addCleanupr   r   gettracer   s    r   setUpzTraceTestCase.setUp\  s<    

clnn55555r   c                 >    | j         rt          j                     d S d S r   )r   r   enabler   s    r   tearDownzTraceTestCase.tearDowna  s%    = 	IKKKKK	 	r   c                       	 t                      S r   r   r"   r   r   make_tracerzTraceTestCase.make_tracere  s    Nxxr   c           
          fd|D             }||k    rT|                      dd                    t          j        d |D             d |D                                 z              d S d S )Nc                 $    g | ]\  }}|z
  |fS r"   r"   )r   leline_offsets      r   
<listcomp>z0TraceTestCase.compare_events.<locals>.<listcomp>k  s&    <<<6Aq1{?A&<<<r   z"events did not match expectation:

c                 ,    g | ]}t          |          S r"   strr   r,   s     r   r   z0TraceTestCase.compare_events.<locals>.<listcomp>o  s    (I(I(IAQ(I(I(Ir   c                 ,    g | ]}t          |          S r"   r   r   s     r   r   z0TraceTestCase.compare_events.<locals>.<listcomp>p  s    (@(@(@AQ(@(@(@r   )failjoindifflibndiff)r   r   r   expected_eventss    `  r   compare_eventszTraceTestCase.compare_eventsj  s    <<<<V<<<_$$II5		'-(I(I(I(I(I(@(@(@(@(@B B C CCD D D D D %$r   c                     |                                  }t          j        |j                    |             t          j        d            |                     |j        j        |j        |           d S r   )r   r   r   r   r   __code__co_firstlinenor   )r   funcr   tracers       r   run_and_comparezTraceTestCase.run_and_comparer  sp    !!##V\"""TDM8"M6	3 	3 	3 	3 	3r   c                 <    |                      ||j                   d S r   )r   r   r   r   s     r   run_testzTraceTestCase.run_testz  s     T4;/////r   c                     |                                  } ||j                   t          j        d            |                     |j        j        |j        |j                   d S r   )r   r   r   r   r   r   r   r   )r   r   r   s      r   	run_test2zTraceTestCase.run_test2}  sg    !!##V\TDM8"M4;	8 	8 	8 	8 	8r   c                 .    t          j        d            d S 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        d            d S # t          j        d            w xY w)Nc                      d S r   r"   r7   s    r   fnz4TraceTestCase.test_set_and_retrieve_func.<locals>.fn      Dr   r   )r   r   s     r   test_set_and_retrieve_funcz(TraceTestCase.test_set_and_retrieve_func  sV    	 	 	 	R	 LCLs   Ac                 :    |                      t                     d S r   )r   r?   r   s    r   test_01_basiczTraceTestCase.test_01_basic  s    er   c                 :    |                      t                     d S r   )r   rH   r   s    r   test_02_arigo0zTraceTestCase.test_02_arigo0      n%%%%%r   c                 :    |                      t                     d S r   )r   rR   r   s    r   test_02_arigo1zTraceTestCase.test_02_arigo1  r   r   c                 :    |                      t                     d S r   )r   rT   r   s    r   test_02_arigo2zTraceTestCase.test_02_arigo2  r   r   c                 :    |                      t                     d S r   )r   r[   r   s    r   test_03_one_instrzTraceTestCase.test_03_one_instr  r   r   c                 :    |                      t                     d S r   )r   rj   r   s    r   test_04_no_pop_blocksz#TraceTestCase.test_04_no_pop_blocks  s    m$$$$$r   c                 :    |                      t                     d S r   )r   rc   r   s    r   test_05_no_pop_topsz!TraceTestCase.test_05_no_pop_tops  s    k"""""r   c                 :    |                      t                     d S r   )r   rA   r   s    r   test_06_callzTraceTestCase.test_06_call  s    dr   c                 :    |                      t                     d S r   )r   rz   r   s    r   test_07_raisezTraceTestCase.test_07_raise  s    j!!!!!r   c                 :    |                      t                     d S r   )r   r   r   s    r   test_08_settrace_and_returnz)TraceTestCase.test_08_settrace_and_return  s    *+++++r   c                 :    |                      t                     d S r   )r   r   r   s    r   test_09_settrace_and_raisez(TraceTestCase.test_09_settrace_and_raise  s    )*****r   c                 :    |                      t                     d S r   )r   r   r   s    r   test_10_ireturnzTraceTestCase.test_10_ireturn  s    o&&&&&r   c                 :    |                      t                     d S r   )r   r   r   s    r   test_11_tightloopzTraceTestCase.test_11_tightloop  s    '(((((r   c                 :    |                      t                     d S r   )r   r   r   s    r   test_12_tighterloopz!TraceTestCase.test_12_tighterloop  s    )*****r   c                 B   |                      t                     |                                 }t          j        |j                   t                       t          j        d            |                     t          j        j        |j	        t          j	                   d S r   )
r   r   r   r   r   r   r   r   r   r   )r   r   s     r   test_13_genexpzTraceTestCase.test_13_genexp  s    '(((
 !!##V+,,,T-6E"M+<+C	E 	E 	E 	E 	Er   c                 <    d }|                      |g d           d S )Nc                  
    d} dS )NTFr   r"   rG   s    r   onlinersz2TraceTestCase.test_14_onliner_if.<locals>.onliners  s    Q1r   )r@   rB   rL   r]   r   )r   r  s     r   test_14_onliner_ifz TraceTestCase.test_14_onliner_if  sG    	 	 	 	  	 	 	 	 	r   c                 r    d }|                      |g d           d }|                      |g d           d S )Nc                  *    t          d          D ]} d S NrK   r`   rG   s    r   for_examplez0TraceTestCase.test_15_loops.<locals>.for_example  s$    1XX   r   )r@   rB   rJ   rB   rJ   rB   rD   c                  0    d} | dk    r| dz  } | dk    d S d S )NrK   r   r>   r"   rG   s    r   while_examplez2TraceTestCase.test_15_loops.<locals>.while_example  s,    Aa%%Q a%%%%%%r   )r@   rJ   rL   rU   rL   rU   rL   r]   r  )r   r#  r%  s      r   test_15_loopszTraceTestCase.test_15_loops  s    	 	 	 	  	 	 		 	 	
 	  		 		 		 		 		r   c                 f    i }t          d|           |                     |d         g d           d S )Na  def f():
































































































































































































































































    passf)r@   )  rC   )r)  rE   execr   )r   	namespaces     r   test_16_blank_linesz!TraceTestCase.test_16_blank_lines  sP    	3Y???cN  	 	 	 	 	r   c                 <    d }|                      |ddg           d S )Nc                  :    d t          j                    _        d} d S r"  )r   r   r   )linenos    r   r   z0TraceTestCase.test_17_none_f_trace.<locals>.func  s    &*CMOO#FFFr   r@   rB   r  r   s     r   test_17_none_f_tracez"TraceTestCase.test_17_none_f_trace  sB    	 	 	 	T	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  \    	 	 t           # t           $ r}  d } ~ ww xY w# t           $ r Y d S w xY wr   rv   )r   r,   ri   s      r   r   z4TraceTestCase.test_18_except_with_name.<locals>.func  sW    $#O  $ $ $$    s   
 
 
++)
r@   rB   rJ   rL   rM   r|   rU   rN      rC   )	   rC   )r7  rE   r  r   s     r   test_18_except_with_namez&TraceTestCase.test_18_except_with_name  sF    		 		 		 	T	 	 	
	 
	 
	 
	 
	r   c                 <    d }|                      |g d           d S )Nc                  H    	 	 t           # d} w xY w# t           $ r d}Y d S w xY w)N	Something   rv   )ri   r   s     r   r   z7TraceTestCase.test_19_except_with_finally.<locals>.func  sE    $#O#AOOOO   s   
  !!)	r@   rB   rJ   rL   r4  rN   rd   rW   rY   r  r   s     r   test_19_except_with_finallyz)TraceTestCase.test_19_except_with_finally  sF    	 	 	 	T  		 		 		 		 		r   c                      G d d          fdfd}|                                  }g d}	  ||j                   n# t          $ r Y nw xY w|                     j        j        |j        |           d S )Nc                        e Zd Zd Zd Zd ZdS )BTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapperc                 .    t          |          | _        d S r   )iter_it)r   objs     r   r   zKTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__init__)  s    99r   c                     | S r   r"   r   s    r   	__aiter__zLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__aiter__,      r   c                 Z   K   	 t          | j                  S # t          $ r t          w xY wr   )nextrC  StopIterationStopAsyncIterationr   s    r   	__anext__zLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__anext__/  s:      ->>)$ - - -,,-s    *N)r   r    r!   r   rF  rL  r"   r   r   AsyncIteratorWrapperr@  (  sA        % % %  - - - - -r   rM  c                  <   K    d          2 3 d {V } | }
6 d}d S )Nabc*   r"   )letterr,   ri   rM  s      r   
doit_asyncz8TraceTestCase.test_20_async_for_loop.<locals>.doit_async5  sO       4 4U ; ;       f !<AAAs   c                                  }	 t          j        |            |                    d            t          j        d            d S # t          j        d            w xY wr   )r   r   send)r   r,   rR  s     r   runz1TraceTestCase.test_20_async_for_loop.<locals>.run:  s^    
A#V$$$tT"""""T""""s   )A A")(r@   rB   )irA   )rC   )rV  rE   irA   rC   rY  rE   r   r   r   r   r>   r|   rJ   rB   r   r   r   r   r[  rJ   rB   r   r   r   r   r[  rJ   rB   r   r   r   r   rq   rC   rr   r{   rt   r[  rL   r]   )r   r   rw   r   r   r   r   )r   rU  r   r   rM  rR  s       @@r   test_20_async_for_loopz$TraceTestCase.test_20_async_for_loop'  s    	- 	- 	- 	- 	- 	- 	- 	-	 	 	 	 	
	# 	# 	# 	# 	# !!##( ( (R	C 	 	 	D	J/>"M6	3 	3 	3 	3 	3s   A 
AAc                    d fd}|                                  } |            }	 t          j        |j                   |                    d            n# t
          $ r Y nw xY wt          j        d            n# t          j        d            w xY wg d}|                     |j        j        |j	        |           d S )Nc                8   K   t          |           D ]}|W V  d S r   r`   )nr   s     r   arangezGTraceTestCase.test_async_for_backwards_jump_has_no_line.<locals>.aranget  s2      1XX   r   c                  F   K    d          2 3 d {V } | dk    r d S 6 d S )NrM   d   r"   )r   ra  s    r   r(  zBTraceTestCase.test_async_for_backwards_jump_has_no_line.<locals>.fw  sU      !6!99       as77EE  %99s    )r@   rB   rp   rr   r   r   r[  rJ   rB   r   rA   rr   r   r   r[  rJ   rB   rd  rr   r   r   r[  rJ   rB   rd  rr   rt   r[  rD   )
r   r   r   r   rT  rw   r   r   r   r   )r   r(  r   coror   ra  s        @r   )test_async_for_backwards_jump_has_no_linez7TraceTestCase.test_async_for_backwards_jump_has_no_lines  s    	 	 		 	 	 	 	
 !!##qss	L&&&IIdOOOO 	 	 	D	 LCL
 
 
< 	AJ5"M6	3 	3 	3 	3 	3s)   .A A= 
A%"A= $A%%A= =Bc                 <    d }|                      |g d           d S )Nc                      	 d S r   r"   r"   r   r   r   z1TraceTestCase.test_21_repeated_pass.<locals>.func  s
    Dr   r@   rB   rJ   rf   r  r   s     r   test_21_repeated_passz#TraceTestCase.test_21_repeated_pass  sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  "    	 dD ]} dS #  Y dS xY w)Nr"   r>   rK   r"   r   s    r   r   z3TraceTestCase.test_loop_in_try_except.<locals>.func  s)    !!AAqqqs   	 r\   r  r   s     r   test_loop_in_try_exceptz%TraceTestCase.test_loop_in_try_except  sF    	 	 	 	T  	 	 	 	 	r   c                 B    fd|                      g d           d S )Nc                  D    	 	 	 	 	  j         dk    r	 n#  Y nxY wd S # w xY wNFFred)r   r   s   r   r   z8TraceTestCase.test_try_except_no_exception.<locals>.func  sI      =F** s     	r@   rB   rJ   rd   rW   r   rC      rC      rC   ry  rE   r  r   s    @r   test_try_except_no_exceptionz*TraceTestCase.test_try_except_no_exception  Q    	 	 	 	 	  	T  		 		 		 		 		r   c                 <    d }|                      |g d           d S )Nc                  R    	 	 	 	 t           #  Y nxY w	 n# w xY wn#  Y nxY wd S # w xY wr   rv   r"   r   r   r   z6TraceTestCase.test_try_exception_in_else.<locals>.func  sU     #O	AA
 BBBBBs(       $ $ &)r@   rB   rJ   rL   rW   r5  )r6  r|   ru  rv     rC   rx  rz  r  r   s     r   test_try_exception_in_elsez(TraceTestCase.test_try_exception_in_else  sF    	 	 	  	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  `    t          d          D ]} t          d          D ]}| |z   }|dk    S )NrK   r>   r`   )r   jrb   s      r   r   z-TraceTestCase.test_nested_loops.<locals>.func  sE    1XX  q  AAAA6Mr   )r@   rB   rJ   rL   rJ   rL   rJ   rB   rJ   rL   rJ   rL   rJ   rB   rU   rl   r  r   s     r   test_nested_loopszTraceTestCase.test_nested_loops   sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  H    ddg} | r|                                  }|rn| d}|S )Nr>   r   c   r5   )seqr`  s     r   r   z)TraceTestCase.test_if_break.<locals>.func  sA    a&C GGII   
 Hr   )r@   rB   rJ   rL   rU   rJ   rL   rU   rN   r5  r6  rE   r  r   s     r   test_if_breakzTraceTestCase.test_if_break  sF    	 	 	 	T
 
 
	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                      d\  } }}}	 t          d          D ]}	 d} |dk    r	 d} d S d} d}# d}w xY wd S #  d}Y d S xY w)N)r>   r>   r>   r  rM   rO   r   r   r6  r  r`   )rb   cdr   s       r   r   z6TraceTestCase.test_break_through_finally.<locals>.func5  s    $JAq!Q
q  Aq55!  B s    7 .7 .7 27 >)r@   rB   rJ   rL   rU   rN   rd   r5  ru  rL   rU   rN   rd   rW   ru     rC   r  rE   r  r   s     r   test_break_through_finallyz(TraceTestCase.test_break_through_finally3  sF    	1 	1 	1 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                      d\  } }}}}	 t          d          D ]}	 d} |dk    r	 d}d}d}# d}w xY wd S #  d}Y d S xY w)N)r>   r>   r>   r>   r  rK   rO   r   r   r6  r  r`   )rb   r   r  r  r   s        r   r   z9TraceTestCase.test_continue_through_finally.<locals>.funcY  s    *MAq!Q
q  Aq55$  B s    6 -6 -6 16 =)r@   rB   rJ   rL   rU   rN   rd   r5  ru  rL   rU   rN   rd   rW   ru  rL   r  r  r  r   s     r   test_continue_through_finallyz+TraceTestCase.test_continue_through_finallyW  sF    	1 	1 	1 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                      	 	 dS # w xY wr"  r"   r"   r   r   r   z7TraceTestCase.test_return_through_finally.<locals>.func~  s    s   rk   r  r   s     r   test_return_through_finallyz)TraceTestCase.test_return_through_finally|  sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  D    	 ddz   n# t           $ r Y nw xY wdS #  Y dS xY w)NrK   r   re   )r   r"   r   r   r   z;TraceTestCase.test_try_except_with_wrong_type.<locals>.func  sH    !    qqqqqqqqs     
  )r@   rB   rJ   r}   rL   rd   r   r  r   s     r   test_try_except_with_wrong_typez-TraceTestCase.test_try_except_with_wrong_type  sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  D    d} dg}|r|                                  | r	 d S r=   r5   TRUEr,   s     r   r   z3TraceTestCase.test_break_to_continue1.<locals>.func  s;    DA  	 r   )
r@   rB   rJ   rL   rU   rN   rd   rW   rL   r]   r  r   s     r   test_break_to_continue1z%TraceTestCase.test_break_to_continue1  sF    	 	 	 	T	 	 	
	 
	 
	 
	 
	r   c                 <    d }|                      |g d           d S )Nc                  L    d} dg}|r|                                  | rn|d S d S r=   r5   r  s     r   r   z3TraceTestCase.test_break_to_continue2.<locals>.func  sO    DA        r   )	r@   rB   rJ   rL   rU   rN   rd   rL   r]   r  r   s     r   test_break_to_continue2z%TraceTestCase.test_break_to_continue2  sF    	 	 	 	T  		 		 		 		 		r   c                 <    d }|                      |g d           d S )Nc                      d} | r| r	 d S d S r=   r"   )r  s    r   r   z/TraceTestCase.test_break_to_break.<locals>.func  s)    D   r   )r@   rB   rJ   rL   rU   rN   rP   r  r   s     r   test_break_to_breakz!TraceTestCase.test_break_to_break  sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  :    dx} }| dk    r|dk    rd}d S d}d S d}d S )Nr>   rV   re   r6  r"   )rb   r   r,   ri   zs        r   r   z+TraceTestCase.test_nested_ifs.<locals>.func  s8    IAAvv66AAAAAAr   r   r  r   s     r   test_nested_ifszTraceTestCase.test_nested_ifs  sF    	 	 	 	T  	 	 	 	 	r   c                 V    fd}dxd|                      |g d           d S )Nc                  V     rrr	t           rdS d S d S dS t          r	t          rdS d S d S )NFT)DEF)ABCs   r   r   z4TraceTestCase.test_nested_ifs_with_and.<locals>.func  sk      ! ) )#(5) )) ) !5 q t   r   TFr\   r  )r   r   r  r  r  s     @@@r   test_nested_ifs_with_andz&TraceTestCase.test_nested_ifs_with_and  sk    		 		 		 		 		 		 		 AT  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  d    d} 	 ddz   n$# t           $ r | dk    rt                      Y nw xY wd}d S )NhellorM   r   raiserX   )ZeroDivisionError
ValueError)r,   r(  s     r   r   z.TraceTestCase.test_nested_try_if.<locals>.func  sW    A'!$ ' ' '<<$,,&  <' AAAs   
 ++	r@   rB   rJ   rL   r4  rU   rN   rW   rY   r  r   s     r   test_nested_try_ifz TraceTestCase.test_nested_try_if	  F    	 	 	 	T  		 		 		 		 		r   c                 \     G d d          fd}|                      |g d           d S )Nc                       e Zd Zd Zd ZdS ).TraceTestCase.test_if_false_in_with.<locals>.Cc                     | S r   r"   r   s    r   r   z8TraceTestCase.test_if_false_in_with.<locals>.C.__enter__"  rG  r   c                      d S 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  !  2              r   r  c                  P                  5  	 d d d            d S # 1 swxY w Y   d S r   r"   r  s   r   r   z1TraceTestCase.test_if_false_in_with.<locals>.func'  sx                       s   )r@   rB   r   rA   r   r   rJ   rB   rp   rr   rt   rD   r  )r   r   r  s     @r   test_if_false_in_withz#TraceTestCase.test_if_false_in_with  sy    	 	 	 	 	 	 	 		 	 	 	 	
 	T
 
 
	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  8    	 d S # t           $ r t           Y d S w xY wr   )rw   Xr"   r   r   r   z7TraceTestCase.test_if_false_in_try_except.<locals>.func;  s7        s   ri  r  r   s     r   test_if_false_in_try_exceptz)TraceTestCase.test_if_false_in_try_except9  sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                        G d d          } d S )Nc                   &    e Zd Zddk     rdZdS dZdS )DTraceTestCase.test_implicit_return_in_class.<locals>.func.<locals>.ArM   r7  r>   rK   N)r   r    r!   rb   r"   r   r   r  r  K  s%        q55AAAAAAr   r  r"   )r  s    r   r   z9TraceTestCase.test_implicit_return_in_class.<locals>.funcJ  s4             r   r@   rB   )r>   rA   rB   rJ   rL   r]   rD   r  r   s     r   test_implicit_return_in_classz+TraceTestCase.test_implicit_return_in_classH  sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  \    	 	 d S # t           $ r} Y d } ~ d S d } ~ ww xY w# t           $ r Y d S w xY wr   rv   exs    r   r   z+TraceTestCase.test_try_in_try.<locals>.func\  s_    D    DDDDD   s   
  
++r\   r  r   s     r   test_try_in_tryzTraceTestCase.test_try_in_try[  sF    	 	 	 	T  	 	 	 	 	r   c                 r    d }|                      |g d           d }|                      |g d           d S )Nc                  f    	 	 t           # t          $ r} Y d } ~ d S d } ~ ww xY w# t           $ r Y d S w xY wr   )	TypeErrorr  r  s    r   r   z:TraceTestCase.test_try_in_try_with_exception.<locals>.funcn  s_    #O!   AAAAA      
 
" " 
00	r@   rB   rJ   rL   r4  rU   rd   rW   rY   c                  f    	 	 t           # t           $ r} Y d } ~ d S d } ~ ww xY w# t          $ r Y d S w xY wr   r  r  r  s    r   r   z:TraceTestCase.test_try_in_try_with_exception.<locals>.func  s`    $$!   AAAAA   r  )r@   rB   rJ   rL   r4  rU   rN   rP   r  r   s     r   test_try_in_try_with_exceptionz,TraceTestCase.test_try_in_try_with_exceptionl  s    	 	 	 	T  		 		 			 	 	 	T  	 	 	 	 	r   c                 >    dd}|                      |g d           d S )Nr   r>   c                     |r
| r|rd S d S d S d S r   r"   )rb   pr  s      r   r   z/TraceTestCase.test_if_in_if_in_if.<locals>.func  s5       	  r   ri  )r   r>   r>   r  r   s     r   test_if_in_if_in_ifz!TraceTestCase.test_if_in_if_in_if  sK    	 	 	 	 	T  	 	 	 	 	r   c                      G d d          fd}fd}|                      |g d           |                      |g d           d S )Nc                       e Zd Zd Zd ZdS )-TraceTestCase.test_early_exit_with.<locals>.Cc                     | S r   r"   r   s    r   r   z7TraceTestCase.test_early_exit_with.<locals>.C.__enter__  rG  r   c                      d S 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                  Z    dD ]&}              5  	 d d d             n# 1 swxY w Y   'd S )Nr>   rK   r"   )r   r  s    r   
func_breakz6TraceTestCase.test_early_exit_with.<locals>.func_break  s      QSS                  Ds   #	#	c                  P                  5  	 d d d            d S # 1 swxY w Y   d S r   r"   r  s   r   func_returnz7TraceTestCase.test_early_exit_with.<locals>.func_return  sv                       s   )r@   rB   rJ   r  r   r   rL   rJ   rp   rr   rt   rU   rl   )r@   rB   )rV  rA   )rC   )r  rE   rJ   rB   rW  rX  rZ  rD   r  )r   r  r  r  s      @r   test_early_exit_withz"TraceTestCase.test_early_exit_with  s    	 	 	 	 	 	 	 		 	 	 	 		 	 	 	 	 	Z  	 	 	 	[
 
 
	 	 	 	 	r   c                 H    d fd}|                      |g d           d S )Nc                 >    | r	 d| dz
  z   n# t           $ r Y nw xY w| S r=   r  rG   s    r   fooz;TraceTestCase.test_flow_converges_on_same_line.<locals>.foo  sC     q1uIII(   DHs    
c                  B    t          d          D ]}  |            d S r"  r`   )r   r  s    r   r   z<TraceTestCase.test_flow_converges_on_same_line.<locals>.func  s1    1XX  A r   )r@   rB   rJ   rY  rA   irC   rr   rt   rB   rJ   r  r  )r   rC   r   )r   r|   r   r\  rr   rt   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                 <    d }|                      |g d           d S )Nc                  L    d} 	 d| z   n# t           $ r}| r Y d }~nd }~ww xY wdS )Nr   r>   doner  )r,   errors     r   r   zCTraceTestCase.test_no_tracing_of_named_except_cleanup.<locals>.func  sa    A!$         6s   
 
!!r  r  r   s     r   'test_no_tracing_of_named_except_cleanupz5TraceTestCase.test_no_tracing_of_named_except_cleanup  sF    	 	 	 	T	 	 			 		 		 		 		r   c                 \     G d d          fd}|                      |g d           d S )Nc                       e Zd Zd Zd ZdS )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__  rG  r   c                     d S 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                  |    	               5  ddz   d d d            d S # 1 swxY w Y   d S # t           $ r Y d S w xY wNr>   r   r  )r  s   r   r   zATraceTestCase.test_tracing_exception_raised_in_with.<locals>.func  s    WYY  aCC                 $   s$   
-  - $- $- 
;;)r@   rB   rJ   r  r   r   rL   r4  rJ   rp   rr   rt   rU   rN   rP   r  )r   r   r  s     @r   %test_tracing_exception_raised_in_withz3TraceTestCase.test_tracing_exception_raised_in_with  sy    	 	 	 	 	 	 	 		 	 	 	 	 	T  	 	 	 	 	r   c                 B    fd|                      g d           d S )Nc                  v    	 n!# xg ct           % x n nn X x Y ncY w xY w	 	 	  j        dk    r	 d S # w xY wrq  )rw   r   rs  s   r   r   z=TraceTestCase.test_try_except_star_no_exception.<locals>.func0  sx      I      =F**s   6 "6 8rt  r  r   s    @r   !test_try_except_star_no_exceptionz/TraceTestCase.test_try_except_star_no_exception.  r|  r   c                 <    d }|                      |g d           d S )Nc                  d    	 n'# xg ct           % x} d } ~ nd } ~  nn X x Y ncY w xY w	 d S # w xY wr   rv   r   s    r   r   zCTraceTestCase.test_try_except_star_named_no_exception.<locals>.funcM  sf      I     s   - '	- /)r@   rB   rJ   rd   r5  r  r  r   s     r   'test_try_except_star_named_no_exceptionz5TraceTestCase.test_try_except_star_named_no_exceptionK  sF    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  r    	 t          d          # xg ct           % x n nn X x Y ncY w xY wd S # w xY wr"  r  r"   r   r   r   zATraceTestCase.test_try_except_star_exception_caught.<locals>.funca  sc     mm#  J    
 s    /4 6r@   rB   rJ   r}   rL   rU   r5  r  r  r   s     r   %test_try_except_star_exception_caughtz3TraceTestCase.test_try_except_star_exception_caught_  F    	 	 	 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                  ~    	 t          d          # xg ct           % x} d } ~ nd } ~  nn X x Y ncY w xY wd S # w xY wr"  r  r  s    r   r   zGTraceTestCase.test_try_except_star_named_exception_caught.<locals>.funcw  sl     mm#  J    
 s    5: <r  r  r   s     r   +test_try_except_star_named_exception_caughtz9TraceTestCase.test_try_except_star_named_exception_caughtu  r  r   c                 <    d }|                      |g d           d S )Nc                      	 	 t          d          # xg ct          % x n nn X x Y d S cY w xY w# t           $ r Y d S w xY wNrM   r  r"   r   r   r   zETraceTestCase.test_try_except_star_exception_not_caught.<locals>.func  s    $Q--'  	    A       s    14 4 
AAr  r  r   s     r   )test_try_except_star_exception_not_caughtz7TraceTestCase.test_try_except_star_exception_not_caught  r  r   c                 <    d }|                      |g d           d S )Nc                      	 	 t          d          # xg ct          % x} d } ~ nd } ~  nn X x Y d S cY w xY w# t           $ r Y d S w xY wr  r  r  s    r   r   zKTraceTestCase.test_try_except_star_named_exception_not_caught.<locals>.func  s    $Q--'  	    AAAA       s    7: : 
AA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                 <    d }|                      |g d           d S )Nc                     	 	 t          dt          d          t          d          g          # xg ct          % x} d } ~ nd } ~  nn t          % x n nn t          % x   n X x Y ncY w xY wnh# xg ct          % xM 	 t          d          # xg ct          % x n nn t          % x} d } ~ nd } ~  nn X x Y ncY w xY wn nn X x Y ncY w xY wdS )NegrO   zbad typery  r   )ExceptionGroupr  r  OSErrorr  s    r   r   z7TraceTestCase.test_try_except_star_nested.<locals>.func  s   	(#A	*(=(=>@ @ @  	    AAAA    A"      J    #B--'      B!    BBBB 1s9   ,/ 4A2#A$	$	A2-A6 6CB/CC	C)r@   rB   rJ   rL   rU   rN   rL   r4  rd   rW   r5  ru  rv  r  r  rx  )ry  r|   )   rC   )   rC   )   rC   )   rC   )r'  rE   r  r   s     r   test_try_except_star_nestedz)TraceTestCase.test_try_except_star_nested  sF    	 	 	* 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                      	 d  d S )Nc                     dS r"  r"   rG   s    r   <lambda>zATraceTestCase.test_notrace_lambda.<locals>.func.<locals>.<lambda>  s    a r   r"   r"   r   r   r   z/TraceTestCase.test_notrace_lambda.<locals>.func  s    KKAr   r\   r  r   s     r   test_notrace_lambdaz!TraceTestCase.test_notrace_lambda  sF    	 	 	
 	T  	 	 	 	 	r   c                 <    d }|                      |g d           d S )Nc                        G d d          } d S )Nc                       e Zd Z	 d ZdS )PTraceTestCase.test_class_creation_with_docstrings.<locals>.func.<locals>.Class_1c                     	 d| _         d S NrO   )rb   r   s    r   r   zYTraceTestCase.test_class_creation_with_docstrings.<locals>.func.<locals>.Class_1.__init__  s    /DFFFr   N)r   r    r!   r   r"   r   r   Class_1r1    s&        '    r   r4  r"   )r4  s    r   r   z?TraceTestCase.test_class_creation_with_docstrings.<locals>.func  s4             r   r  r  r   s     r   #test_class_creation_with_docstringsz1TraceTestCase.test_class_creation_with_docstrings  sF    	 	 	 	T  	 	 	 	 	r   c                 @   t          j        d          }d fd}g d}g }|                    |            |             t          j        d            |j        j        fd|D             }|                     ||           |                     ||           d S )N	_testcapic               3      K   dV  d S r=   r"   r"   r   r   genzFTraceTestCase.test_no_line_event_after_creating_generator.<locals>.gen  s      GGGGGr   c                  "                 D ]} d S r   r"   )_r9  s    r   r   zGTraceTestCase.test_no_line_event_after_creating_generator.<locals>.func  s'       r   )r@   rJ   rB   rp   rr   rt   rU   rB   )rs   rA   rt   rD   c                 <    g | ]\  }}}|z
  t           |         fS r"   )EVENT_NAMES)r   whatrC   r   
start_lines       r   r   zMTraceTestCase.test_no_line_event_after_creating_generator.<locals>.<listcomp>,  s=     
 
 
!tS *_k$/0
 
 
r   )	r   import_modulesettrace_to_recordr   r   r   r   assertEqualr   )r   r7  r   EXPECTED_EVENTSr   r9  r?  s        @@r   +test_no_line_event_after_creating_generatorz9TraceTestCase.test_no_line_event_after_creating_generator  s    
 "/<<		 	 		 	 	 	 	
 
 
  $$V,,,ddfffcl46H6H6H]1

 
 
 
%+
 
 
 	111T?33333r   c                    dfd}	 |t          j                    _        t          j        |           t	          g            |                     d           n|# t          $ ro}d}|j        }|r#|j        j	        j
        dk    r|dz  }|j        }|#|dk    r|                     d           n|dk    r|                     d           Y d }~nd }~ww xY wt          j        d            d S # t          j        d            w xY w)	NFc                 (    s	dt           t          S r   )rw   r  )r   r   r   raiseds      r   
error_oncez5TraceTestCase.test_settrace_error.<locals>.error_once7  s      Lr   No exception raisedr   test_settrace_errorr>   Traceback is missing frame"Traceback has frame more than once)r   r   r   r   lenr   rw   __traceback__tb_framef_codeco_nametb_next)r   rH  r  counttbrG  s        @r   rJ  z!TraceTestCase.test_settrace_error4  s?   	 	 	 	 		&0CMOO#L$$$GGG II+,,,,  
	@ 
	@ 
	@E!B  ;%-1FFFQJEZ    zz		67777		>???
	@ LCLs0   ;A C- 
C%A%C
C- CC- -Dc                    t          j        d          }	 |                    g            t          g            |                     d           n|# t
          $ ro}d}|j        }|r#|j        j        j	        dk    r|dz  }|j
        }|#|dk    r|                     d           n|dk    r|                     d           Y d }~nd }~ww xY wt          j        d            d S # t          j        d            w xY w)Nr7  rI  r   test_testcapi_settrace_errorr>   rK  rL  )r   r@  settrace_to_errorrM  r   rw   rN  rO  rP  rQ  rR  r   r   )r   r7  r  rS  rT  s        r   rV  z*TraceTestCase.test_testcapi_settrace_errorR  s(    "/<<		''+++GGG II+,,,,  
	@ 
	@ 
	@E!B  ;%-1OOOQJEZ    zz		67777		>???
	@ LCLs/   $A C" 
C	A%C?C" C		C" "C8c                 |    i }t          dddz  d|           |d         }g d}|                     ||           d S )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   rJ   )i  rC   )  rC   )rY  rE   r*  )r   r  r(  rC  s       r   test_very_large_functionz&TraceTestCase.test_very_large_functionk  so    
 ))),
 ./	0 	0 	0 cF
 
 
 	Q00000r   N)Mr   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-  r1  r8  r=  r]  rf  rj  rn  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-  r5  r   cpython_onlyrD  rJ  rV  rZ  r"   r   r   r   r   X  s}       6 6 6
     \D D D3 3 30 0 08 8 8& & &    & & && & && & && & &% % %# # #  " " ", , ,+ + +' ' ') ) )+ + +E E E
 
 
  >      0  *J3 J3 J3X23 23 23h	 	 	  "  :  @  4  2" " "H# # #J    &  .  .  $  (  .  ,  4    &  "' ' 'R  ", , ,\" " "H  ,  @  :  (  ,  ,  ,  ,- - -^    & )4 )4 )4V  <   01 1 1 1 1r   r   )rA   r|   rC   rE   c                   6     e Zd Z	  fdZed             Z xZS )SkipLineEventsTraceTestCasec                 f    d |D             }t                                          |||           d S )Nc                 *    g | ]}|d          dk    |S rB   r"   r   r   s     r   r   z>SkipLineEventsTraceTestCase.compare_events.<locals>.<listcomp>  s!    III!!A$&..A...r   )superr   )r   r   r   r   skip_line_events	__class__s        r   r   z*SkipLineEventsTraceTestCase.compare_events  s:    IIIII{F4DEEEEEr   c                  "    t          d          S )NF)r   r   r"   r   r   r   z'SkipLineEventsTraceTestCase.make_tracer  s    ....r   r   r    r!   r   r[  r   __classcell__rd  s   @r   r^  r^    s[        BF F F F F / / \/ / / / /r   r^  c                   6     e Zd Z	  fdZed             Z xZS )TraceOpcodesTestCasec                     d |D             }t          |          dk    r2|                     t          |          t          |          d           t                                          |||           d S )Nc                 *    g | ]}|d          dk    |S )r>   opcoder"   ra  s     r   r   z7TraceOpcodesTestCase.compare_events.<locals>.<listcomp>  s&    DDDA1Q483C3Ca3C3C3Cr   r>   z)No 'opcode' events received by the tracer)msg)rM  
assertLessrb  r   )r   r   r   r   skip_opcode_eventsrd  s        r   r   z#TraceOpcodesTestCase.compare_events  s}    DDDDDv;;??OOC 233S[[ K  M M M{,>PPPPPr   c                  "    t          d          S )NT)r   r   r"   r   r   r   z TraceOpcodesTestCase.make_tracer  s    $////r   rf  rh  s   @r   rj  rj    s[        EQ Q Q Q Q 0 0 \0 0 0 0 0r   rj  c                   P    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dS )RaisingTraceFuncTestCasec                 h    |                      t          j        t          j                               d S r   r   r   r   r   r   s    r   r   zRaisingTraceFuncTestCase.setUp  s$    clnn55555r   c                 6    	 || j         k    rt          | j        S r   )raiseOnEventr  r   r   s       r   r   zRaisingTraceFuncTestCase.trace  s#    	!D%%%:r   c                 0    	 | j         dk    r	d}d|z  }d S dS )Nr|   r   r>   )rw  )r   r,   ri   s      r   r(  zRaisingTraceFuncTestCase.f  s-    	E++A!AAA1r   c                 V   	 || _         	 t          t          j                    dz             D ]U}t          j        | j                   	 |                                  |                     d           F# t          $ r Y Rw xY wd S # t          $ r |                     d           Y d S w xY w)Nr>   zexception not raised!zrecursion counter not reset)
rw  ra   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22Q677 7 7TZ(((7FFHHH II56666 "   D	7 7  	5 	5 	5II3444444	5s5   >B 	A3B 3
B =B ?B  B B('B(c                 0    |                      d           d S )NrA   r{  r   s    r   	test_callz"RaisingTraceFuncTestCase.test_call      '''''r   c                 0    |                      d           d S NrC   r}  r   s    r   	test_linez"RaisingTraceFuncTestCase.test_line  r  r   c                 0    |                      d           d S )NrE   r}  r   s    r   test_returnz$RaisingTraceFuncTestCase.test_return  s    )))))r   c                 0    |                      d           d S Nr|   r}  r   s    r   test_exceptionz'RaisingTraceFuncTestCase.test_exception  s    ,,,,,r   c                     d fdt          j                   	               |                     d           d S # t          $ r dd l} |j                     Y d S w xY w)Nc                  H    t          d          D ]} t          |            d S r3  )ra   printrm  s    r   r(  z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.f  s.    1XX  a r   c                 b    |dk    r'| j         j        j        dz   k    rt          d          S )NrC   rK   zi am crashing)r   r   r   r   )r   whyextrar(  gs      r   r  z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.g  s6    v!*";a"???"?3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  s    	 	 		 	 	 	 	 	 	Q	2ACCC II011111  	 	 	IIIBJLLLLLL	s   
A A#"A#c                      d } fdt          j                    }	 t          j                   	  |             n# t          $ r Y nw xY wt          j        |           d S # t          j        |           w xY w)Nc                      d} | j          d S )Nr   )no_such_attrrG   s    r   r(  z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.f  s    ANNNNr   c                 V    |dk    r!|\  }}}                     |t                     S r  )assertIsInstancerw   )r   r   r   typer|   r   r  r   s         r   r  z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g  s5    $$),&i%%i;;;Hr   )r   r   r   AttributeError)r   r(  existingr  s   `  @r   test_exception_argumentsz1RaisingTraceFuncTestCase.test_exception_arguments  s    	 	 		 	 	 	 	 	 <>>	#LOOO!    L"""""CL""""s-   A& 
A  A&  
A
A& AA& &A<c                    t          d          fdd }|                     t                     5 }t          j                    |             d d d            n# 1 swxY w Y   |                     |j                   d S )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>.trace  s    $(E!Lr   c                      d S r   r"   r"   r   r   r(  zNRaisingTraceFuncTestCase.test_line_event_raises_before_opcode_event.<locals>.f  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_event  s    w''		 	 	 	 	 	
	 	 	z** 	fLACCC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	f&	22222s   A  A$'A$N)r   r    r!   r   r   r(  r{  r~  r  r  r  r  r  r  r"   r   r   rs  rs    s        6 6 6    5 5 5"( ( (( ( (* * *- - -2 2 2,# # #,3 3 3 3 3r   rs  c                   "    e Zd Z	 	 	 ddZd ZdS )
JumpTracerrC   Fc                     |j         | _        || _        || _        || _        |rd n| j        j        | _        d| _        d S )NF)r   codejumpFromjumpTor   r   	firstLiner  )r   functionr  r  r   	decorateds         r   r   zJumpTracer.__init__  sA    %	 
!*H	0H			r   c                    | j         rd S | j        %|j        | j        k    r|dk    r|j        dz
  | _        || j        k    r| j        |j        | j        | j        z   k    rh|}|)|j        | j        k    r|j        }||j        | j        k    |9	 | j        | j        z   |_        n# t          $ r | j        |_        Y nw xY wd| _         | j
        S )NrC   r>   T)r  r  rP  r  r   r   r  r   r  r  r   )r   r   r   r   r(  s        r   r   zJumpTracer.trace   s    9 	F
 N"u|ty'@'@"^a/DNTZDN$>$.4="@@@A-AH	$9$9H -AH	$9$9}1%)^dk%AENN  1 1 1%)[ENNN1 	zs   B% %B>=B>N)rC   F)r   r    r!   r   r   r"   r   r   r  r    s@        H9?        r   r  c                     	 |                      d           d S # t          $ r/}|                      dt          |          v            Y d }~d S d }~ww xY w)NrK   integer)r   r  r   r   r   s     r   no_jump_to_non_integersr  :  sm    +a + + +i3q66)*********+s    
A$AAc                      	 t          j                    j        } | j        | _        t	          d          # t
          $ r}dt          |          vr Y d }~d S 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  B  s}    
H/"0"9 FGGG     #a&&   !     s   $5 
AAAc                      e 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          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          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@          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             Z. eddg dH          dI             Z/ eddg dH          dJ             Z0 eddg dK          dL             Z1 eddg dK          dM             Z2 edNd'g dO          dP             Z3 eddg dQ          dR             Z4 eddg dQ          dS             Z5 eddg dT          dU             Z6 eddNg dV          dW             Z7 ed
d$d$dNg          dX             Z8 ed
d$d$dNg          dY             Z9 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             Z? ed
dg edcf          dd             Z@ ed
dg edcf          de             ZA eddddgedcf          df             ZB eddddgedgf          dh             ZC ed
dg edif          dj             ZD ed
dg edif          dk             ZE eddg dledif          dm             ZF eddg dledif          dn             ZG ed
dddg          do             ZH eddg dp          dq             ZI ed
ddg          dr             ZJ eddg ds          dt             ZK edd$g d;          du             ZL ed
ddg          dv             ZM eddg dw          dx             ZN edd
g dy          dz             ZO ed
dg ed{f          d|             ZP ed
dg ed{f          d}             ZQ eddg d~ed{f          d             ZR edddged{f          d             ZS ed$d
g d          d             ZT ed$d
g d          d             ZU eddg d          d             ZV eddg d          d             ZW edd$ddged+f          d             ZX ed$dd
dgedcf          d             ZY ed$dd
dgedcf          d             ZZd Z[d Z\d Z]d Z^ eddd
gdedf          d             Z_ edd
d
gdedf          d             Z` edd
d
gd)edf          d             Za eddddgd          d             Zb eddd
dg          d             Zc edd
g           d             Zd edNdg d          d             Ze eddd
dg          d             Zf edd
g           d             Zg edNdg d          d             Zh edd$g edif          d             Zi eddNg edif          d             Zj edd$g edif          d             Zk eddd
dg          d             Zl eddg d          d             Zm enjo        d          d             Zp eddd
dg          d             ZqdS )JumpTestCasec                     |                      t          j        t          j                               t          j        d            d S r   ru  r   s    r   r   zJumpTestCase.setUpQ  4    clnn555Tr   c                     ||k    r=|                      dt          |          z   dz   dz   t          |          z              d S d S )NzOutputs don't match:
Expected: r   z
Received: )r   repr)r   expectedreceiveds      r   compare_jump_outputz JumpTestCase.compare_jump_outputU  sf    xII $&*8nn57;<#$&*8nn5 6 6 6 6 6  r   NrC   Fc                 ~   |}t          |d          r|j        }t          |d          t          |||||          }	t          j        |	j                   g }
| ||
           n- | j        | 5   ||
           d d d            n# 1 swxY w Y   t          j        d            |                     ||
           d S N__wrapped__)hasattrr  r  r   r   r   assertRaisesRegexr  r   r   r  r  r  r  r   r  wrappedr   r   s              r   r   zJumpTestCase.run_test[  s   g}-- 	*)G g}-- 	* GXvuiHHV\"""=DLLLL''/  V              T  622222s   0BBBc                    |}t          |d          r|j        }t          |d          t          |||||          }	t          j        |	j                   g }
|t          j         ||
                     n? | j        | 5  t          j         ||
                     d d d            n# 1 swxY w Y   t          j        d            t          j	        d            | 
                    ||
           d S r  )r  r  r  r   r   r   asynciorU  r  set_event_loop_policyr  r  s              r   run_async_testzJumpTestCase.run_async_testl  s=   g}-- 	*)G g}-- 	* GXvuiHHV\"""=KV%%%%''/ * *DDLL)))* * * * * * * * * * * * * * *T%d+++  622222s   B,,B03B0c                 $     	  fd}|S )Nc                 H     t                      fd            }|S )Nc           	      @    |                      d           d S NT)r  r   r  )r   r   r  r   r  r   r  r  s    r   r9   z7JumpTestCase.jump_test.<locals>.decorator.<locals>.test  s<    dHfh$)$  H H H H Hr   r   r   r9   r  r   r  r  r  s   ` r   	decoratorz)JumpTestCase.jump_test.<locals>.decorator  W    4[[H H H H H H H H H [H Kr   r"   r  r  r  r  r   r  s   ````` r   	jump_testzJumpTestCase.jump_test~  A    		 	 	 	 	 	 	 	 	 r   c                 $     	  fd}|S )Nc                 H     t                      fd            }|S )Nc           	      @    |                      d           d S r  )r  r  s    r   r9   z=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.test  s>    ##D(FH$)$ $ H H H H H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>   rM   c                     |                      d           |                      d           |                      d           d S Nr>   rK   rM   r   r   s    r   test_jump_simple_forwardsz&JumpTestCase.test_jump_simple_forwards  >    aaar   rK   )r>   r>   rK   c                 Z    |                      d           |                      d           d S r_   r  r  s    r   test_jump_simple_backwardsz'JumpTestCase.test_jump_simple_backwards  ,    aar   rV   rO   c                 f    d }||                      d           d S |                      d           d S NrM   rO   r  r   r,   s     r   test_jump_is_none_forwardsz'JumpTestCase.test_jump_is_none_forwards  s<    9MM!MM!r   re   )rM   rO   re   c                     d }||                      d           n|                      d           |                      d           d S NrM   rO   re   r  r  s     r   test_jump_is_none_backwardsz(JumpTestCase.test_jump_is_none_backwards  sK    9MM!MM!ar   c                 f    d }||                      d           d S |                      d           d S r  r  r  s     r   test_jump_is_not_none_forwardsz+JumpTestCase.test_jump_is_not_none_forwards  s<    =MM!MM!r   )rO   rO   re   c                     d }||                      d           n|                      d           |                      d           d S r  r  r  s     r   test_jump_is_not_none_backwardsz,JumpTestCase.test_jump_is_not_none_backwards  sK    =MM!MM!ar   c                     dD ]1}|                      d           dD ]}|                      d           2|                      d           d S )Nr  rK   rM   rV   rO   r  r   r   r  s      r   test_jump_out_of_block_forwardsz,JumpTestCase.test_jump_out_of_block_forwards  sd     	! 	!AMM! ! !a    !ar   )r>   rM   rO   r>   rM   rO   re   rX   c                     |                      d           dD ]F}|                      d           dD ]}|                      d           |                      d           G|                      d           d S )Nr>   r   rM   )rK   rO   re   rX   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 ]W} |ddg          2 3 d {V }|                      d           |                      d           26 |                      d           Xd S )Nr   r>   rK   rM   rV   rO   r  r   r-   r   s      r   )test_jump_out_of_async_for_block_forwardsz6JumpTestCase.test_jump_out_of_async_for_block_forwards  s        	 	A$9aV,, ! ! ! ! ! ! !aa   a     - MM!		 	s   A)rK   rV   rK   rV   rO   re   c                    K   dD ]k}|                      d            |dg          2 3 d {V }|                      d           |                      d           26 |                      d           ld S )Nr   rK   r>   rV   rO   re   r  r  s      r   *test_jump_out_of_async_for_block_backwardsz7JumpTestCase.test_jump_out_of_async_for_block_backwards  s        	 	AMM!$9aS>> ! ! ! ! ! ! !aa   a     * MM!	 	s   Ac                 Z    |                      d           |                      d           d S )Nr>   rM   r  r  s    r   test_jump_to_codeless_linez'JumpTestCase.test_jump_to_codeless_line  s,    aar   )r>   rK   rM   c                     |                      d           |                      d           |                      d           d S r  r  r  s    r   test_jump_to_same_linez#JumpTestCase.test_jump_to_same_line  r  r   r7  c                    	 |                      d           |                      d           	 |                      d           |                      d           n# |                      d           w xY w|                      d           d S # |                      d           	 |                      d           |                      d           n# |                      d           w xY w|                      d           w xY w)NrK   rV   re   r6  r7  r  r  s    r   test_jump_in_nested_finallyz(JumpTestCase.test_jump_in_nested_finally  s    	MM!MM!!a   a    a    MM! MM!!a   a    a    MM!s.   B	 A A/	C; C5C;C""C;rX    c                     	 |                      d           ddz   	 |                      d           |                      d           d S # |                      d           |                      d           w xY w)NrK   r>   r   re   rX   r  r  s    r   test_jump_in_nested_finally_2z*JumpTestCase.test_jump_in_nested_finally_2  s|    	MM!aCCMM!MM! MM!MM!s   A	 	,A5rw  c                    	 |                      d           ddz   	 |                      d           	 |                      d           |                      d           n# |                      d           w xY w|                      d           d S # |                      d           	 |                      d           |                      d           n# |                      d           w xY w|                      d           w xY w)NrK   r>   r   re   r6  r   rw  r  r  s    r   test_jump_in_nested_finally_3z*JumpTestCase.test_jump_in_nested_finally_3  s   
	MM!aCCMM!"a   b!!!!b!!!!MM" MM!"a   b!!!!b!!!!MM"s.   B A A5D&C;DC((Dr|   c                     	 |                      d           |                      d           |                      d           d S # |                      d           |                      d            Y d S xY wNrK   rV   rO   r  r  s    r   5test_no_jump_over_return_try_finally_in_finally_blockzBJumpTestCase.test_no_jump_over_return_try_finally_in_finally_block  s{    
	MM!MM!MM!F MM!MM!FFF
 DD   A ,A2afterc                 Z    |                      d           	 |                      d           )Nr>   TrM   r  r  s    r    test_no_jump_infinite_while_loopz-JumpTestCase.test_no_jump_infinite_while_loop,  s0    a	MM!	r   c                     d}|                      d           |dk    r"|                      d           |dz  }|dk     d S d S )Nr>   rK   rV   r  r   r   s     r   #test_jump_forwards_into_while_blockz0JumpTestCase.test_jump_forwards_into_while_block3  sP    a1ffMM!FA 1ffffffr   )rM   rM   rM   rO   c                     d}|dk    r |                      d           |dz  }|dk     |                      d           d S )Nr>   rK   rM   rO   r  r  s     r   $test_jump_backwards_into_while_blockz1JumpTestCase.test_jump_backwards_into_while_block;  sP    1ffMM!FA 1ff 	ar   c                     t          | d          5  |                     d           d d d            n# 1 swxY w Y   |                     d           d S r  r
   r   r  s    r   $test_jump_forwards_out_of_with_blockz1JumpTestCase.test_jump_forwards_out_of_with_blockC      &!$$ 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	a   377c                    K   t          | d          4 d {V  |                     d           d d d           d {V  n# 1 d {V swxY w Y   |                     d           d S r  r$   r   r  s    r   *test_jump_forwards_out_of_async_with_blockz7JumpTestCase.test_jump_forwards_out_of_async_with_blockI        $VQ// 	 	 	 	 	 	 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	a   A
AA)r>   rK   r>   rK   rM   rs   c                     |                      d           t          | d          5  |                      d           d d d            d S # 1 swxY w Y   d S r  r   r
   r  s    r   %test_jump_backwards_out_of_with_blockz2JumpTestCase.test_jump_backwards_out_of_with_blockO      a&!$$ 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   A		AAc                    K   |                      d           t          | d          4 d {V  |                      d           d d d           d {V  d S # 1 d {V swxY w Y   d S r  r   r$   r  s    r   +test_jump_backwards_out_of_async_with_blockz8JumpTestCase.test_jump_backwards_out_of_async_with_blockU        a$VQ// 	 	 	 	 	 	 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   A
A!$A!c                     	 |                      d           |                      d           n# |                      d           w xY w|                      d           d S r  r  r  s    r   +test_jump_forwards_out_of_try_finally_blockz8JumpTestCase.test_jump_forwards_out_of_try_finally_block[  ^    	MM!MM!FMM!a	   - A)r>   r>   rM   rO   c                     |                      d           	 |                      d           |                      d           d S # |                      d           w xY wNr>   rM   rO   r  r  s    r   ,test_jump_backwards_out_of_try_finally_blockz9JumpTestCase.test_jump_backwards_out_of_try_finally_blockc  [    a	MM!MM!FMM!   A Ac                     	 |                      d           n#  |                      d            xY w|                      d           d S NrK   rV   re   r  r  s    r   *test_jump_forwards_out_of_try_except_blockz7JumpTestCase.test_jump_forwards_out_of_try_except_blockk  R    	MM!	MM!a    0)r>   r>   rM   c                     |                      d           	 |                      d           d S #  |                      d            xY wr%  r  r  s    r   +test_jump_backwards_out_of_try_except_blockz8JumpTestCase.test_jump_backwards_out_of_try_except_blockt  O    a	MM!	MM!	   . A)rV   rX   r6  c                     	 ddz   nZ# t           $ r- |                     d           |                     d           Y n$t          $ r |                     d           Y nw xY w|                     d           d S Nr>   r   rV   rO   rX   r6  r  r   FloatingPointErrorr  s    r   test_jump_between_except_blocksz,JumpTestCase.test_jump_between_except_blocks}  s    	aCCC  	 	 	MM!MM!! 	 	 	MM!	as    4AAAc                    	 ddz   n:# t           $ r- |                     d           |                     d           Y nw xY w|                     d           n# |                     d           w xY w|                     d           d S r3  )r  r   r  s    r    test_jump_from_except_to_finallyz-JumpTestCase.test_jump_from_except_to_finally  s    	aCCC  	 	 	MM!MM!	 MM!FMM!as!    A 4?A ?A A/)rV   re   rX   c                     	 ddz   nF#  |                      d           |                      d           |                      d           Y nxY w|                      d           d S )Nr>   r   rV   rO   re   rX   r  r  s    r   test_jump_within_except_blockz*JumpTestCase.test_jump_within_except_block  so    	aCCC	MM!MM!MM!as
    AA)r>   rO   r>   rO   c                     |                      d           	 ddz   n,# t          $ r}|                      d           Y d }~nd }~ww xY wd}d S )Nr>   r   rO   rP  r   r  )r   r   r,   s      r   test_jump_over_try_exceptz&JumpTestCase.test_jump_over_try_except  sm    a	EEE  	 	 	MM!	s    
AAA)r>   rV   rO   r   c                 &   |                      d           t          | d          5  |                      d           d d d            n# 1 swxY w Y   t          | d          5  |                      d           d d d            d S # 1 swxY w Y   d S Nr>   rK   rM   rV   rO   r  r  s    r   test_jump_across_withz"JumpTestCase.test_jump_across_with     a&!$$ 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	&!$$ 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	#   AAA#BB
B
c                 r  K   |                      d           t          | d          4 d {V  |                      d           d d d           d {V  n# 1 d {V swxY w Y   t          | d          4 d {V  |                      d           d d d           d {V  d S # 1 d {V swxY w Y   d S r?  r  r  s    r   test_jump_across_async_withz(JumpTestCase.test_jump_across_async_with       a$VQ// 	 	 	 	 	 	 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	$VQ// 	 	 	 	 	 	 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	#   A
A #A =B&&
B03B0)r>   rM   rO   re   c                    |                      d           dD ]T}t          | d          5  |                      d           d d d            n# 1 swxY w Y   |                      d           U|                      d           d S Nr>   r   rM   rV   rO   re   r  r  s     r   ,test_jump_out_of_with_block_within_for_blockz9JumpTestCase.test_jump_out_of_with_block_within_for_block  s    a 	 	Afa(( ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM!as   AA	A	c                 0  K   |                      d           dD ]f}t          | d          4 d {V  |                      d           d d d           d {V  n# 1 d {V swxY w Y   |                      d           g|                      d           d S rH  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3 ! ! ! ! ! ! ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM!as   A
A$	'A$	)r>   rK   rM   rO   rs   re   c                 N   |                      d           t          | d          5  t          | d          5  |                      d           d d d            n# 1 swxY w Y   |                      d           d d d            n# 1 swxY w Y   |                      d           d S Nr>   rK   rM   rV   rO   re   r  r  s    r   -test_jump_out_of_with_block_within_with_blockz:JumpTestCase.test_jump_out_of_with_block_within_with_block  s   a&!$$ 	 	fa(( ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	as4   BABA	B A	!BB	B	c                 v  K   |                      d           t          | d          5  t          | d          4 d {V  |                      d           d d d           d {V  n# 1 d {V swxY w Y   |                      d           d d d            n# 1 swxY w Y   |                      d           d S rM  )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  sz     a&!$$ 	 	(33 ! ! ! ! ! ! ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	as4   BA'B'
A1	1B4A1	5BB B)rK   rV   re   rX   c                    	 |                      d           t          | d          5  |                      d           d d d            n# 1 swxY w Y   |                      d           nW# t          | d          5  |                      d           d d d            n# 1 swxY w Y   |                      d           w xY w|                      d           d S NrK   rV   rO   re   rX   r  r  s    r   0test_jump_out_of_with_block_within_finally_blockz=JumpTestCase.test_jump_out_of_with_block_within_finally_block  sO   	MM!fa(( ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM! fa(( ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM!as@   A* A		AA*B>;BB>B!!B>$B!%B>c                   K   	 |                      d           t          | d          4 d {V  |                      d           d d d           d {V  n# 1 d {V swxY w Y   |                      d           ni# t          | d          4 d {V  |                      d           d d d           d {V  n# 1 d {V swxY w Y   |                      d           w xY w|                      d           d S rR  r  r  s    r   6test_jump_out_of_async_with_block_within_finally_blockzCJumpTestCase.test_jump_out_of_async_with_block_within_finally_block  s     	MM!(33 ! ! ! ! ! ! ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM! )33 ! ! ! ! ! ! ! !a   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !MM!as@   A> A
A!$A!>C$B=+C$=
CC$
CC$r6  )r>   rM   rO   rw  r  c                    |                      d           dD ]}|                      d           dD ]b}|                      d           	 dD ]}|                      d           	 |                      d           I# |                      d           w xY w|                      d           |                      d	           d S )
Nr>   r   rM   r  rO   r6  r   rw  r  r  )r   r   r  ks       r   &test_jump_out_of_complex_nested_blocksz3JumpTestCase.test_jump_out_of_complex_nested_blocks  s    a 		 		AMM! & &a   &# ) )a(((() MM"%%%%FMM"%%%%MM"bs   	A::B)r>   rK   rO   c                     |                      d           t          | d          5 }|                      d           d d d            n# 1 swxY w Y   |                      d           d S Nr>   rK   rV   rO   r  r  s     r    test_jump_out_of_with_assignmentz-JumpTestCase.test_jump_out_of_with_assignment  s    a&!$$ 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	as   AAAc                    K   |                      d           t          | d          4 d {V 	 }|                      d           d d d           d {V  n# 1 d {V swxY w Y   |                      d           d S rZ  r  r  s     r   &test_jump_out_of_async_with_assignmentz3JumpTestCase.test_jump_out_of_async_with_assignment	  s     a$VQ// 	 	 	 	 	 	 	 	MM!	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	as   A
A!$A!)r>   re   r6  r7  c                 D   |                      d           	 |                      d           | s	 |                      d           d S |                      d           |                      d           n# |                      d           w xY w|                      d           d S )Nr>   rM   r6  re   r7  r  r  s    r   *test_jump_over_return_in_try_finally_blockz7JumpTestCase.test_jump_over_return_in_try_finally_block	  s    a	MM!  MM! MM!MM!FMM!as   A1 A1 1B)r>   rM   r6  r   rw  r  c                    |                      d           	 |                      d           	 |                      d           | s	 |                      d           n[|                      d           |                      d           n# |                      d           w xY w|                      d           	 |                      d           d S )	Nr>   TrM   rO   r   r6  rw  r  r  r  s    r   )test_jump_over_break_in_try_finally_blockz6JumpTestCase.test_jump_over_break_in_try_finally_block	  s    a
	MM!"a     b!!!! a   b!!!!b!!!!MM"bs   B B Bc                     |                      d           | sdD ]}|                      d           n*|                      d           |                      d           |                      d           d S Nr>   r  rV   re   rX   r6  r  r  s     r   $test_jump_over_for_block_before_elsez1JumpTestCase.test_jump_over_for_block_before_else)	      a 	 ! !a    ! MM!MM!ar   c                   K   |                      d           | s/t          dg          2 3 d {V }|                      d           6 n*|                      d           |                      d           |                      d           d S Nr>   rM   rV   re   rX   r6  r   r-   r  s     r   *test_jump_over_async_for_block_before_elsez7JumpTestCase.test_jump_over_async_for_block_before_else4	        a 	$aS>> ! ! ! ! ! ! !aa     *> MM!MM!a   Ac                 Z    |                      d           |                      d           d S r_   r  r  s    r   test_no_jump_too_far_forwardsz*JumpTestCase.test_no_jump_too_far_forwardsA	  r  r   rs   beforec                 Z    |                      d           |                      d           d S r_   r  r  s    r   test_no_jump_too_far_backwardsz+JumpTestCase.test_no_jump_too_far_backwardsF	  r  r   exceptc                 h    	 |                      d           d S #  |                      d            xY wNrK   rV   r  r  s    r   test_no_jump_to_except_1z%JumpTestCase.test_no_jump_to_except_1L	  s=    	MM!	MM!s    1c                 z    	 |                      d           d S # t          $ r |                      d            w xY wrs  r   r  r  s    r   test_no_jump_to_except_2z%JumpTestCase.test_no_jump_to_except_2T	  sO    	MM! 	 	 	MM!	s    !:c                     	 |                      d           d S # t          $ r}|                      d           |d }~ww xY wrs  rv  r  s     r   test_no_jump_to_except_3z%JumpTestCase.test_no_jump_to_except_3\	  sU    	MM! 	 	 	MM!G	s    
?:?c                     	 |                      d           d S # t          t          f$ r}|                      d           |d }~ww xY wrs  )r   r  r   r  s     r   test_no_jump_to_except_4z%JumpTestCase.test_no_jump_to_except_4d	  sZ    	MM!L) 	 	 	MM!G	s    AAAintoc                 d    |                      d           dD ]}|                      d           d S )Nr>   r  rM   r  r  s     r   $test_no_jump_forwards_into_for_blockz1JumpTestCase.test_no_jump_forwards_into_for_blockl	  sB    a 	 	AMM!	 	r   c                    K   |                      d           t          ddg          2 3 d {V }|                      d           6 d S r  rh  r  s     r   *test_no_jump_forwards_into_async_for_blockz7JumpTestCase.test_no_jump_forwards_into_async_for_blockr	  sk      a !Q(( 	 	 	 	 	 	 	!MM! )s   Ac                 d    dD ]}|                      d           |                      d           d S )Nr  rK   rM   r  r  s     r   %test_no_jump_backwards_into_for_blockz2JumpTestCase.test_no_jump_backwards_into_for_blocky	  s>     	 	AMM!ar   z&can't jump into the body of a for loopc                    K   t          ddg          2 3 d {V }|                     d           6 |                     d           d S r  )r-   r   r  s     r   +test_no_jump_backwards_into_async_for_blockz8JumpTestCase.test_no_jump_backwards_into_async_for_block	  sl       !Q(( 	 	 	 	 	 	 	!MM! )as   1stackc                     |                      d           t          | d          5  |                      d           d d d            d S # 1 swxY w Y   d S r  r  r  s    r   %test_no_jump_forwards_into_with_blockz2JumpTestCase.test_no_jump_forwards_into_with_block	  r  r  c                    K   |                      d           t          | d          4 d {V  |                      d           d d d           d {V  d S # 1 d {V swxY w Y   d S r  r  r  s    r   +test_no_jump_forwards_into_async_with_blockz8JumpTestCase.test_no_jump_forwards_into_async_with_block	  r  r  )r>   rK   r   c                     t          | d          5  |                     d           d d d            n# 1 swxY w Y   |                     d           d S 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 {V  |                     d           d d d           d {V  n# 1 d {V swxY w Y   |                     d           d S r  r  r  s    r   ,test_no_jump_backwards_into_async_with_blockz9JumpTestCase.test_no_jump_backwards_into_async_with_block	  r  r  c                     |                      d           	 |                      d           |                      d           d S # |                      d           w xY wr%  r  r  s    r   )test_jump_forwards_into_try_finally_blockz6JumpTestCase.test_jump_forwards_into_try_finally_block	  r'  r(  )rK   rV   rK   rV   rO   c                     	 |                      d           |                      d           n# |                      d           w xY w|                      d           d S r  r  r  s    r   *test_jump_backwards_into_try_finally_blockz7JumpTestCase.test_jump_backwards_into_try_finally_block	  r"  r#  c                     |                      d           	 |                      d           d S #  |                      d            xY wr%  r  r  s    r   (test_jump_forwards_into_try_except_blockz5JumpTestCase.test_jump_forwards_into_try_except_block	  r0  r1  )rK   rK   re   c                     	 |                      d           n#  |                      d            xY w|                      d           d S r*  r  r  s    r   )test_jump_backwards_into_try_except_blockz6JumpTestCase.test_jump_backwards_into_try_except_block	  r,  r-  c                     	 ddz   na# t           $ r- |                     d           |                     d           Y n+t          $ r}|                     d           Y d }~nd }~ww xY w|                     d           d S r3  r4  r  s     r   !test_jump_between_except_blocks_2z.JumpTestCase.test_jump_between_except_blocks_2	  s    	aCCC  	 	 	MM!MM!! 	 	 	MM!	as    4A&	A&A!!A&c                     |                      d           	 |                      d           |                      d           d S # |                      d           w xY wr%  r  r  s    r   test_jump_into_finally_blockz)JumpTestCase.test_jump_into_finally_block	  r'  r(  )rK   re   rX   c                 :   	 |                      d           |                      d           |                      d           |                      d           n/# |                      d           |                      d           w xY w|                      d           d S )NrK   rM   rO   re   rX   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! MM!MM!as   *A ,B)r>   rM   r>   rM   rO   c                     |                      d           	 |                      d           |                      d           d S # |                      d           w xY wr%  r  r  s    r   test_jump_out_of_finally_blockz+JumpTestCase.test_jump_out_of_finally_block	  r'  r(  z9can't jump into an 'except' block as there's no exceptionc                     |                      d           	 |                      d           d S #  |                      d           Y d S xY wr%  r  r  s    r   #test_no_jump_into_bare_except_blockz0JumpTestCase.test_no_jump_into_bare_except_block	  sU    a	MM!	MM!s	   . Ac                     |                      d           	 |                      d           d S # t          $ r |                      d           Y d S w xY wr%  r   rw   r  s    r   (test_no_jump_into_qualified_except_blockz5JumpTestCase.test_no_jump_into_qualified_except_block	  sg    a	MM! 	 	 	MM!	s   . AA)rK   rO   re   c                     	 |                      d           |                      d           n0#  |                      d           |                      d            xY w|                      d           d S NrK   rM   rO   re   r6  r  r  s    r   2test_no_jump_into_bare_except_block_from_try_blockz?JumpTestCase.test_no_jump_into_bare_except_block_from_try_block	  sv    	MM!MM!	MM!MM!as	   *- -Ac                     	 |                      d           |                      d           n9# t          $ r, |                      d           |                      d            w xY w|                      d           d S r  r<  r  s    r   7test_no_jump_into_qualified_except_block_from_try_blockzDJumpTestCase.test_no_jump_into_qualified_except_block_from_try_block 
  s    	MM!MM!  	 	 	MM!MM!	 	as	   *- 6A#)r>   rM   re   r>   rM   re   rX   c                     |                      d           	 |                      d           ddz   d S #  |                      d           |                      d           Y d S xY wNr>   rM   r   re   rX   r  r  s    r   "test_jump_out_of_bare_except_blockz/JumpTestCase.test_jump_out_of_bare_except_block
  sn    a	MM!aCCCC	MM!MM!s	   3 ,A"c                     |                      d           	 |                      d           ddz   d S # t          $ r. |                      d           |                      d           Y d S w xY wr  r  r  s    r   'test_jump_out_of_qualified_except_blockz4JumpTestCase.test_jump_out_of_qualified_except_block
  s    a	MM!aCCCC 	 	 	MM!MM!	s   3 4A+*A+)r>   rK   rO   rs   c                 &   |                      d           t          | d          5  |                      d           d d d            n# 1 swxY w Y   t          | d          5  |                      d           d d d            d S # 1 swxY w Y   d S r?  r  r  s    r   test_jump_between_with_blocksz*JumpTestCase.test_jump_between_with_blocks
  rA  rB  c                 r  K   |                      d           t          | d          4 d {V  |                      d           d d d           d {V  n# 1 d {V swxY w Y   t          | d          4 d {V  |                      d           d d d           d {V  d S # 1 d {V swxY w Y   d S r?  r  r  s    r   #test_jump_between_async_with_blocksz0JumpTestCase.test_jump_between_async_with_blocks'
  rE  rF  c                     	 |                      d           |                      d           |                      d           d S # |                      d           |                      d            Y d S 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/
  sx    	MM!MM!MM!F MM!MM!FFFFFFr  c                     |                      d           | sdD ]}|                      d           n*|                      d           |                      d           |                      d           d S rc  r  r  s     r   'test_no_jump_into_for_block_before_elsez4JumpTestCase.test_no_jump_into_for_block_before_else9
  re  r   c                   K   |                      d           | s/t          dg          2 3 d {V }|                      d           6 n*|                      d           |                      d           |                      d           d S rg  rh  r  s     r   -test_no_jump_into_async_for_block_before_elsez:JumpTestCase.test_no_jump_into_async_for_block_before_elseD
  rj  rk  c                 B    |                      t          dddg           d S )NrK   SpamT)r   r  r   s    r   test_no_jump_to_non_integersz)JumpTestCase.test_no_jump_to_non_integersO
  s#    -q&4&AAAAAr   c                 "    t                       d S r   )r  r   s    r   #test_no_jump_without_trace_functionz0JumpTestCase.test_no_jump_without_trace_functionR
  s     	'(((((r   c                 r    i }t          ddz  |           |d         }|                     |dddg           d S )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(  rK   i  r   )r+  r   )r   r  r(  s      r   test_large_functionz JumpTestCase.test_large_functionW
  sX      '' )*	+ 	+ 	+ cFaD1#&&&&&r   c                 (   t          ddd           G fdd          }t          |dd          }t          j        |j                   dg i}t          |           t          j        d            |                     g d	|d                    d S )
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 ZdS )<JumpTestCase.test_jump_to_firstlineno.<locals>.fake_functionN)r   r    r!   r   )r  s   r   fake_functionr  o
  s        HHHr   r  rV   r>   r   )rK   rM   rK   rM   rV   )compiler  r   r   r   r+  r  )r   r  r   r,  r  s       @r   test_jump_to_firstlinenoz%JumpTestCase.test_jump_to_firstlinenoe
  s      
 f 	 	 	 	 	 	 	 	 	 	M1a00V\"""rN	T9T  )H2EFFFFFr   rA   z5can't jump from the 'call' trace event of a new frame)r   r  c                 z                           d            fd} |                                   d           d S )Nr>   c                  2                          d           d S r  r  r  s   r   nestedz3JumpTestCase.test_no_jump_from_call.<locals>.nested|
  s    MM!r   rO   r  )r   r  s   ` r   test_no_jump_from_callz#JumpTestCase.test_no_jump_from_callx
  sS     	a	 	 	 	 	ar   rE   z'can only jump from a 'line' trace eventc                 0    |                      d           d S r=   r  r  s    r   test_no_jump_from_return_eventz+JumpTestCase.test_no_jump_from_return_event
  s     	ar   c                 :    |                      d           ddz   d S r  r  r  s    r   !test_no_jump_from_exception_eventz.JumpTestCase.test_no_jump_from_exception_event
  s#     	a	Ar   )r   c                 j      fd}t           |                                            d           d S )Nc               3   >   K                         d           dV  d S )NrK   rM   r  r  s   r   r9  z.JumpTestCase.test_jump_from_yield.<locals>.gen
  s&      MM!GGGGGr   rO   )rI  r   )r   r9  s   ` r   test_jump_from_yieldz!JumpTestCase.test_jump_from_yield
  sG    	 	 	 	 	 	SSUUar   c                     |                      d           d t          d          D             }|                      d           d S )Nr>   c                     g | ]}|S r"   r"   r   r   s     r   r   z@JumpTestCase.test_jump_forward_over_listcomp.<locals>.<listcomp>
      """1Q"""r   r   rM   r   ra   r  s     r   test_jump_forward_over_listcompz,JumpTestCase.test_jump_forward_over_listcomp
  sE    a""b		"""ar   c                 @    d}d t          d          D             }d}d S )Nr>   c                     g | ]}|S r"   r"   r  s     r   r   zAJumpTestCase.test_jump_backward_over_listcomp.<locals>.<listcomp>
  r  r   r   rM   r`   r   rb   r,   r  s       r    test_jump_backward_over_listcompz-JumpTestCase.test_jump_backward_over_listcomp
  s)    ""b		"""r   )rK   rX   rK   c                     d}|                      d           |rd S d t          d          D             }d}|                      d           |                      d           d S )NFrK   c                     g | ]}|S r"   r"   r  s     r   r   zDJumpTestCase.test_jump_backward_over_listcomp_v2.<locals>.<listcomp>
  s    !!!1Q!!!r   rO   re   rX   r6  r  r   flagr,   s      r   #test_jump_backward_over_listcomp_v2z0JumpTestCase.test_jump_backward_over_listcomp_v2
  sn    a 	F!!a!!!aar   c                    K   |                      d           d t          t          d                    2              d {V }|                      d           d S )Nr>   c                 "   K   g | 3 d {V }|
6 S r   r"   r  s     r   r   zFJumpTestCase.test_jump_forward_over_async_listcomp.<locals>.<listcomp>
  .      33333333Q3333   r   rM   r   r-   ra   r  s     r   %test_jump_forward_over_async_listcompz2JumpTestCase.test_jump_forward_over_async_listcomp
  sc      a33ib		22333333333ar   c                 j   K   d}d t          t          d                    2              d {V }d}d S )Nr>   c                 "   K   g | 3 d {V }|
6 S r   r"   r  s     r   r   zGJumpTestCase.test_jump_backward_over_async_listcomp.<locals>.<listcomp>
  r  r  r   rM   )r-   ra   r  s       r   &test_jump_backward_over_async_listcompz3JumpTestCase.test_jump_backward_over_async_listcomp
  sG      33ib		22333333333r   c                    K   d}|                      d           |rd S d t          t          d                    2              d {V }d}|                      d           |                      d           d S )NFrK   c                 "   K   g | 3 d {V }|
6 S r   r"   r  s     r   r   zJJumpTestCase.test_jump_backward_over_async_listcomp_v2.<locals>.<listcomp>
  s.      22222222Q2222r  rO   re   rX   r6  r  r  s      r   )test_jump_backward_over_async_listcomp_v2z6JumpTestCase.test_jump_backward_over_async_listcomp_v2
  s      a 	F22ia11222222222aar   )r  c                     d}t          |                     d                     |                     d           |dz   dz    |                     d           d S Nr>   rM   rO   r   r  r$  r  r   r   rb   s     r   (test_jump_with_null_on_stack_load_globalz5JumpTestCase.test_jump_with_null_on_stack_load_global
  sr    MM!	
 	
 	
 	a 
   	br   c                     d}t           } ||                     d                     |                     d           |dz   dz    |                     d           d S )Nr>   rV   re   rw  ry     r  )r   rb   r(  s      r   &test_jump_with_null_on_stack_push_nullz3JumpTestCase.test_jump_with_null_on_stack_push_null
  sy    	MM!	
 	
 	
 	a 
   	br   c                     d}t                               | d           |                     d           |dz   dz    |                     d           d S r  )listr   r  s     r   &test_jump_with_null_on_stack_load_attrz3JumpTestCase.test_jump_with_null_on_stack_load_attr
  sl    A	
 	
 	
 	a 
   	br   c                     |                      d           |                      d          pd^}}}|                      d           d S Nr>   rK   r  rM   r  r   r;  s     r   (test_jump_extended_args_unpack_ex_simplez5JumpTestCase.test_jump_extended_args_unpack_ex_simple
  sH    a==##-vAqar   )r>   rV   rV   rO   c                     |                      d           |                      d          pd^}}}|                      d           d S )Nr>   rV   r  rO   r  r  s     r   (test_jump_extended_args_unpack_ex_trickyz5JumpTestCase.test_jump_extended_args_unpack_ex_tricky  sN    a MM!&	
1ar   cpuc                     dddgd t          dd          D             d}i }t          d                    |          |           |d	         }|                     |d
dddg           d S )Nzdef f(output):z    output.append(1)z    for _ in spam:c              3   "   K   | ]
}d | dV  dS )z        output.append()Nr"   r  s     r   r   z@JumpTestCase.test_jump_extended_args_for_iter.<locals>.<genexpr>  s.      GG+q+++GGGGGGr   rM   i z    output.append(100_000)r   r(  rK   r>   )ra   r+  r   r   )r   sourcer,  r(  s       r    test_jump_extended_args_for_iterz-JumpTestCase.test_jump_extended_args_for_iter  s    
 " 
 HGU1g5F5FGGG	

 *
 	TYYv	***cNa!Wq'l33333r   c                     |                      d           |                      d          od}|                      d           d S r  r  r  s     r   test_jump_or_popzJumpTestCase.test_jump_or_pop  sB    aMM!'ar   )NrC   Fr  )rr   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/  r6  r8  r:  r=  r@  rD  rI  rK  rN  rP  rS  rU  rX  r[  r]  r_  ra  rd  ri  rm  rp  rt  rw  ry  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  P  s         6 6 6 @D).3 3 3 3" FJ).3 3 3 3$
 
 
 

 
 
 
 Yq!aS  
 Yq!YYY    Yq!aS   Yq!YYY    Yq!aS   Yq!YYY    Yq!aV   Yq!---..  /. _QAq6""  _ #" _Q---..  _ /. Yq!aS  
 Yq!YYY    Yq!aV	 	 	 Yq!aV/455  65 Yq"q"g 12677  87 Yq"q!fz;788  98 Yq!aS:w/00  10 Yq!aV   Yq!\\\""  #" Yq!aV  
 _QAq6""  #"
 Yq!((())  *)
 _Q...//  0/
 Yq!aS   Yq!\\\""  #" Yq!aS   Yq!YYY    Yq!YYY    Yq!YYY    Yq!YYY    Yq!\\\""  #" Yq!]]]##  $# _Q===))  *) Yq!\\\""  #" _Q<<<((  )( Yq!((())  *) _Q...//  0/ Yq!\\\""  #" _Q<<<((  )( Yq"'''((  )( Yq!YYY    _Q999%%  &% Yq!\\\""	 	 #"	 Yq!***++  ,+ Yq!aV   _QAq6""  #" Yq!aS:w/00  10 Yq"qcJ122  32
 Yq!aS:x011  21 Yq!aS:x011  21 Yq!aS:x011  21 Yq!aS:x011  21 Yq!R*f-..  /.
 _Q2
F344  54 Yq!aVj&122  32
 _QAq6J0X#YZZ  [Z
 Yq!R*g.//  0/
 _Q2
G455  65
 Yq!ZZZ*g!677  87
 _Q:::
G'<==  >=
 Yq!aV   Yq!___%%  &% Yq!aS   Yq!YYY    Yq!YYY    Yq!aS   Yq!YYY    Yq!___%%  &% Yq!R*&abcc  dc Yq!R*&abcc  dc Yq!YYY-h ijj  kj Yq!aS:'bcdd  ed Yq!***++  ,+ Yq!***++  ,+ Yq!]]]##  $# _Q===))  *) Yq!aVj'233  43 Yq!aVj&122  32 _QAq6J#788  98B B B) ) )
' ' 'G G G& Yq!aSz <8 /9 : : : : : Yq!aS81: ; ; ; ; ; Yq!aSJ84: ; ; ; ; ; Yq!aV8,,,  -, Yq!aV   Yq!R  
 Yq!YYY    _QAq6""  #"
 _Q2  
 _Q999%%  &% Yq!R
G4555  65$ Yq!R
G4555  65& Yq!R
G4555  65" Yq!aV  
 Yq!\\\""  #" Wu%%4 4 &%4 Yq!aV    r   r  c                   &    e Zd Zd Zd Zd Zd ZdS )TestExtendedArgsc                     |                      t          j        t          j                               t          j        d            d S r   ru  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>.trace0  s    5MMMQMMMLr   )ra   r   r   )r   r   r;  r  r   s      @@r   count_traceszTestExtendedArgs.count_traces*  s    r 	 	ADFFFFQ!44	 	 	 	 	 	 	UTr   c                     i }d}t          ||           |                     |d                   }|                     |dddd           d S )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  rB  )r   nsr  r  s       r   test_trace_unpack_long_sequencez0TestExtendedArgs.test_trace_unpack_long_sequence:  sV    AT2""2c7++!SA!F!FGGGGGr   c                 @   d                     d                    d t          d          D                                 }d t          d          D             }t          ||           |                     |d                   }|                     |dddd	           d S )
Nzeif 1:
            def f():
                return (
                    {}
                )
        z
+
c              3   "   K   | ]
}d | dV  dS )varr   Nr"   r  s     r   r   z>TestExtendedArgs.test_trace_lots_of_globals.<locals>.<genexpr>G  s*      AAaAAAAAAr   i  c                     i | ]}d | |	S )r  r"   r  s     r   
<dictcomp>z?TestExtendedArgs.test_trace_lots_of_globals.<locals>.<dictcomp>H  s     000qiAii000r   r(  r>   i  r	  )formatr   ra   r+  r  rB  )r   r  r  r  s       r   test_trace_lots_of_globalsz+TestExtendedArgs.test_trace_lots_of_globalsA  s    
 F7<<AAU4[[AAAAABB 	 10E$KK000T2""2c7++!TQ!G!GHHHHHr   N)r   r    r!   r   r  r  r  r"   r   r   r  r  $  sX             H H H
I 
I 
I 
I 
Ir   r  c                        e Zd Zd Zd Zd ZdS )TestEdgeCasesc                     |                      t          j        t          j                               t          j        d            d S r   ru  r   s    r   r   zTestEdgeCases.setUpP  r  r   c                    d }d  G fdd          }t          j         |                       t          j                    5 }t          j        |           |                     |j        j        |j                   |                     |j        j	        t                     d d d            n# 1 swxY w Y   |                     t          j                    |           d S )Nc                      d S r   r"   r   s    r   r  z*TestEdgeCases.test_reentrancy.<locals>.fooU      Cr   c                      d S r   r"   r   s    r   barz*TestEdgeCases.test_reentrancy.<locals>.barX  r  r   c                        e Zd Zd Z fdZdS )(TestEdgeCases.test_reentrancy.<locals>.Ac                     d S r   r"   )r   r7   s     r   __call__z1TestEdgeCases.test_reentrancy.<locals>.A.__call__\  r  r   c                 0    t          j                   d S r   r   )r   r  s    r   __del__z0TestEdgeCases.test_reentrancy.<locals>.A.__del___  s    S!!!!!r   N)r   r    r!   r"  r$  )r  s   r   r  r   [  s=          " " " " " " "r   r  )r   r   r   catch_unraisable_exceptionrB  
unraisableobjectr$  r  	exc_valuer   r   )r   r  r  cmr  s       @r   test_reentrancyzTestEdgeCases.test_reentrancyT  sH   	 	 		 	 		" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	QQSS/11 	IRLR]119===!!"-"9<HHH	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I 	I
 	-----s   AB11B58B5c                     d }t          j        |           ~t          j        t          j                               d S )Nc                      d S r   r"   r   s    r   r  z+TestEdgeCases.test_same_object.<locals>.fool  r  r   )r   r   r   )r   r  s     r   test_same_objectzTestEdgeCases.test_same_objectk  sB    	 	 	 	SS\^^$$$$$r   N)r   r    r!   r   r*  r-  r"   r   r   r  r  N  sA          . . ..% % % % %r   r  __main__)7r9   r   unittestunittest.mockr   r   r   r   	functoolsr   r  test.supportr   requires_working_socketr
   r$   r-   r;   r?   r   rH   rR   rT   r[   rc   rj   rn   rA   rx   rz   r   r   r   r   r   r   r   r   r   r   TestCaser   r=  r^  r\  rj  rs  r  r  r  r  r  r  r   mainr"   r   r   <module>r6     s          # # # # # # 



  				        & & & & & &  t , , , ,
( 
( 
( 
( 
( 
( 
( 
(
( 
( 
( 
( 
( 
( 
( 
(  
       
 
 
' ' ' 
 
 
' ' '   ' ' ' 
 
 

( ( (   	% 	% 	% 
 
 
' ' ' 
 
 
        
$ 
$ 
$
 / / /$ $ $ ,_      , , ,    ) ) )   + + +  "  + + +      	- 	- 	- )+6;
< )-89         0g1 g1 g1 g1 g1H% g1 g1 g1T)  	/ 	/ 	/ 	/ 	/- 	/ 	/ 	/ 	0 0 0 0 0= 0 0 0g3 g3 g3 g3 g3x0 g3 g3 g3\# # # # # # # #L+ + +H H HQ Q Q Q Q8$ Q Q Qh'I 'I 'I 'I 'Ix( 'I 'I 'IT#% #% #% #% #%H% #% #% #%L zHMOOOOO r   