HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/test/__pycache__/test_sys_settrace.cpython-38.opt-2.pyc
U

.D�gW��@s�ddlmZddlZddlZddlZddlZddlmZddlZGdd�d�Z	Gdd�d�Z
dd	�Zd
d�Zdd
dge_
dd�Zdd
dddge_
dd�Zdd
dddge_
dd�Zdd
ddddge_
dd�Zdd
dddge_
dd �Zdd
ddd!ddddd"g
e_
d#d$�Zdd
ddd%ge_
d&d'�Zd(d)�Zdd
d*d+d,dge_
d-d.�Zd/d0�Zdd
dd*d+d1d,d2ddd%ge_
d3d4�Zd5d6�Zdge_
d7d8�Zd9d:�Zd2ddd%ge_
d;d<�Zdd
dddd!d=ge_
d>d?�Zdd
ddddddd@d!ddge_
dAdB�Zdd
dddddddCdd!d=ge_
dDdE�ZdFdG�Z dddHdIdJdKdLdMdNdOg
dd!gdPddge _
GdQdR�dR�Z!GdSdT�dTej"�Z#GdUdV�dVe#�Z$ej%GdWdX�dXe#��Z&GdYdZ�dZej"�Z'Gd[d\�d\�Z(d]d^�Z)d_d`�Z*Gdadb�dbej"�Z+e,dck�r�e�-�dS)d�)�supportN��wrapsc@s$eZdZdd�Zdd�Zdd�ZdS)�tracecontextcCs||_||_dS�N��output�value��selfrr	�r�5/opt/cppython/lib/python3.8/test/test_sys_settrace.py�__init__sztracecontext.__init__cCs|j�|j�dSr�r�appendr	�rrrr
�	__enter__sztracecontext.__enter__cGs|j�|j�dSrr�r�exc_inforrr
�__exit__sztracecontext.__exit__N)�__name__�
__module__�__qualname__rrrrrrr
rsrc@s$eZdZdd�Zdd�Zdd�ZdS)�asynctracecontextcCs||_||_dSrrr
rrr
rszasynctracecontext.__init__c�s|j�|j�dSrrrrrr
�
__aenter__szasynctracecontext.__aenter__c�s|j�|j�dSrrrrrr
�	__aexit__!szasynctracecontext.__aexit__N)rrrrrrrrrr
rsrcCs|D]
}|VqdSrr)�iterable�xrrr
�	asynciter$srcCsdS�N�rrrrr
�basic+sr!�r�call�r �line�r �returncCsd}~d}dSrr�rrrr
�arigo_example0;sr)��r%)�r%)r,r'cCsd}~d}dSrrr(rrr
�arigo_example1Hsr-cCsd}~d}dSrrr(rrr
�arigo_example2Usr.��r%)�r%)r1r'cCsd}~d}dSrrr(rrr
�one_instr_linegsr2��r%�r4r'cCs$d}td�D]}|rd}qd}qdS�Nr r+��range)r�arrr
�no_pop_topsrs
r:)�r%)r+r'cCsd}|stqd}dSr)Zbla)�yrrrr
�
no_pop_blocks�sr=)r0r'cCsd}dSrrr(rrr
�called�sr>cCs
t�dSr)r>rrrr
r#�sr#)���r#)���r%)r@r'cCst�dSr)�	Exceptionrrrr
�raises�srBc
Cs6z
t�Wn&tk
r0}zd}W5d}~XYnXdSr)rBrA)�excrrrr
�
test_raise�s
rD)r@�	exception)r+rEcCst�|�|t��j_dSr)�sys�settrace�	_getframe�f_back�f_trace��	tracefuncrrr
�_settrace_and_return�s
rMcCst|�dSr)rMrKrrr
�settrace_and_return�srNcCst�|�|t��j_t�dSr)rFrGrHrIrJ�RuntimeErrorrKrrr
�_settrace_and_raise�s
rPc
Cs4zt|�Wn"tk
r.}zW5d}~XYnXdSr)rPrO)rLrCrrr
�settrace_and_raise�srQcCsd}d}||kr|d}ndS)Nr,r r)r9�brrr
�ireturn_example�s

rS)r;r'cCs>tdd�}zd}||}|d7}qWntk
r8YnXdS)Nrr4r �r8�
IndexError)�items�irRrrr
�tightloop_example�s
rX)r,rEcCs6tdd�}zd}||}qWntk
r0YnXdS)Nr r0rrT)rVrWrrr
�tighterloop_example�s
rY)r0rEccsz
dVW5XdS)NTrrrrr
�generator_functionsrZcCs tt��}td�D]}|}qdS)N�
)�anyrZr8)rr<rrr
�generator_examples
r])i����r#)���r%)���r%)r_r')r_r#)r_rE)���r%)r`r'r[c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�TracerNcCs||_||_g|_dSr)�trace_line_events�trace_opcode_events�events)rrbrcrrr
r+szTracer.__init__cCs(|jdk	r|j|_|jdk	r$|j|_dSr)rb�
f_trace_linesrc�f_trace_opcodes)r�framerrr
�_reconfigure_frame0s

zTracer._reconfigure_framecCs"|�|�|j�|j|f�|jSr�rhrdr�f_lineno�trace�rrg�event�argrrr
rk6s
zTracer.tracecCs0|�|�dd�dD�|j�|j|f�|jS)Ncss|]
}|VqdSrr)�.0�orrr
�	<genexpr>=sz)Tracer.traceWithGenexp.<locals>.<genexpr>�r rirlrrr
�traceWithGenexp;s
zTracer.traceWithGenexp)NN)rrrrrhrkrsrrrr
ra*s
rac@s�eZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9S):�
TraceTestCasecCs(t��|_t��|�tjt���dSr)�gc�	isenabled�using_gc�disable�
addCleanuprFrG�gettracerrrr
�setUpFs
zTraceTestCase.setUpcCs|jrt��dSr)rwru�enablerrrr
�tearDownKszTraceTestCase.tearDowncCst�Sr�rarrrr
�make_tracerOszTraceTestCase.make_tracerc
sN�fdd�|D�}||krJ|�dd�t�dd�|D�dd�|D����dS)Ncsg|]\}}|�|f�qSrr)ro�l�e��line_offsetrr
�
<listcomp>Usz0TraceTestCase.compare_events.<locals>.<listcomp>z"events did not match expectation:
�
cSsg|]}t|��qSr��str�rorrrr
r�YscSsg|]}t|��qSrr�r�rrr
r�Zs)�fail�join�difflibZndiff)rr�rd�expected_eventsrr�r
�compare_eventsTs���zTraceTestCase.compare_eventscCs<|��}t�|j�|�t�d�|�|jj|j|�dSr)rrFrGrkr��__code__�co_firstlinenord)r�funcrd�tracerrrr
�run_and_compare\s

�zTraceTestCase.run_and_comparecCs|�||j�dSr)r�rd�rr�rrr
�run_testdszTraceTestCase.run_testcCs6|��}||j�t�d�|�|jj|j|j�dSr)rrkrFrGr�r�r�rd)rr�r�rrr
�	run_test2gs


�zTraceTestCase.run_test2cCst�d�dSr�rFrGrrrr
�test_set_and_retrieve_nonens
z(TraceTestCase.test_set_and_retrieve_nonec	Cs(dd�}t�|�zW5t�d�XdS)NcWsdSrr)�argsrrr
�fnssz4TraceTestCase.test_set_and_retrieve_func.<locals>.fnr�)rr�rrr
�test_set_and_retrieve_funcrs

z(TraceTestCase.test_set_and_retrieve_funccCs|�t�dSr)r�r!rrrr
�
test_01_basic|szTraceTestCase.test_01_basiccCs|�t�dSr)r�r)rrrr
�test_02_arigo0~szTraceTestCase.test_02_arigo0cCs|�t�dSr)r�r-rrrr
�test_02_arigo1�szTraceTestCase.test_02_arigo1cCs|�t�dSr)r�r.rrrr
�test_02_arigo2�szTraceTestCase.test_02_arigo2cCs|�t�dSr)r�r2rrrr
�test_03_one_instr�szTraceTestCase.test_03_one_instrcCs|�t�dSr)r�r=rrrr
�test_04_no_pop_blocks�sz#TraceTestCase.test_04_no_pop_blockscCs|�t�dSr)r�r:rrrr
�test_05_no_pop_tops�sz!TraceTestCase.test_05_no_pop_topscCs|�t�dSr)r�r#rrrr
�test_06_call�szTraceTestCase.test_06_callcCs|�t�dSr)r�rDrrrr
�
test_07_raise�szTraceTestCase.test_07_raisecCs|�t�dSr)r�rNrrrr
�test_08_settrace_and_return�sz)TraceTestCase.test_08_settrace_and_returncCs|�t�dSr)r�rQrrrr
�test_09_settrace_and_raise�sz(TraceTestCase.test_09_settrace_and_raisecCs|�t�dSr)r�rSrrrr
�test_10_ireturn�szTraceTestCase.test_10_ireturncCs|�t�dSr)r�rXrrrr
�test_11_tightloop�szTraceTestCase.test_11_tightloopcCs|�t�dSr)r�rYrrrr
�test_12_tighterloop�sz!TraceTestCase.test_12_tighterloopcCsH|�t�|��}t�|j�t�t�d�|�tjj|j	tj	�dSr)
r�r]rrFrGrsr�r�r�rd)rr�rrr
�test_13_genexp�s


�zTraceTestCase.test_13_genexpcCs dd�}|�|ddddg�dS)NcSsd}dS)NFrrr(rrr
�onliners�sz2TraceTestCase.test_14_onliner_if.<locals>.onlinersr"r$r3r5�r�)rr�rrr
�test_14_onliner_if�s��z TraceTestCase.test_14_onliner_ifcCsJdd�}|�|dddddddg�dd�}|�|ddd	d
d	d
d	dg�dS)NcSstd�D]}qdS�Nr+r7r(rrr
�for_example�sz0TraceTestCase.test_15_loops.<locals>.for_exampler"r$r*r&cSsd}|dkr|d8}qdS)Nr+rr rr(rrr
�
while_example�sz2TraceTestCase.test_15_loops.<locals>.while_exampler3r/r5r�)rr�r�rrr
�
test_15_loops�s2��
��zTraceTestCase.test_15_loopscCs(i}td|�|�|ddddg�dS)Nadef f():
































































































































































































































































    pass�fr")�r%)r�r')�execr�)r�	namespacerrr
�test_16_blank_lines�s
��z!TraceTestCase.test_16_blank_linescCsdd�}|�|ddg�dS)NcSsdt��_d}dSr�)rFrHrJ)�linenorrr
r��s
z0TraceTestCase.test_17_none_f_trace.<locals>.funcr"r$r�r�rrr
�test_17_none_f_trace�s��z"TraceTestCase.test_17_none_f_traceN) rrrr{r}�staticmethodrr�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
rtBs:


	rtcs(eZdZ�fdd�Zedd��Z�ZS)�SkipLineEventsTraceTestCasecs"dd�|D�}t��|||�dS)NcSsg|]}|ddkr|�qSr$r�ror�rrr
r��sz>SkipLineEventsTraceTestCase.compare_events.<locals>.<listcomp>)�superr�)rr�rdr�Zskip_line_events��	__class__rr
r��sz*SkipLineEventsTraceTestCase.compare_eventscCs
tdd�S)NF)rbr~rrrr
r�sz'SkipLineEventsTraceTestCase.make_tracer�rrrr�r�r�
__classcell__rrr�r
r��sr�cs(eZdZ�fdd�Zedd��Z�ZS)�TraceOpcodesTestCasecsFdd�|D�}t|�dkr2|jt|�t|�dd�t��|||�dS)NcSsg|]}|ddkr|�qS)r Zopcoderr�rrr
r��sz7TraceOpcodesTestCase.compare_events.<locals>.<listcomp>r z)No 'opcode' events received by the tracer)�msg)�lenZ
assertLessr�r�)rr�rdr�Zskip_opcode_eventsr�rr
r��s�z#TraceOpcodesTestCase.compare_eventscCs
tdd�S)NT)rcr~rrrr
r�sz TraceOpcodesTestCase.make_tracerr�rrr�r
r��sr�c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�RaisingTraceFuncTestCasecCs|�tjt���dSr�ryrFrGrzrrrr
r{szRaisingTraceFuncTestCase.setUpcCs||jkrt�n|jSdSr)�raiseOnEvent�
ValueErrorrkrlrrr
rks
zRaisingTraceFuncTestCase.tracecCs |jdkrd}d|}ndSdS)NrErr )r�)rrr<rrr
r�
s

zRaisingTraceFuncTestCase.fc	Cs|||_zRtt��d�D]<}t�|j�z|��Wntk
rHYqX|�d�qWnt	k
rv|�d�YnXdS)Nr zexception not raised!zrecursion counter not reset)
r�r8rF�getrecursionlimitrGrkr�r�r�rO)rrmrWrrr
�run_test_for_eventsz+RaisingTraceFuncTestCase.run_test_for_eventcCs|�d�dS)Nr#�r�rrrr
�	test_call'sz"RaisingTraceFuncTestCase.test_callcCs|�d�dS)Nr%r�rrrr
�	test_line)sz"RaisingTraceFuncTestCase.test_linecCs|�d�dS)Nr'r�rrrr
�test_return+sz$RaisingTraceFuncTestCase.test_returncCs|�d�dS�NrEr�rrrr
�test_exception-sz'RaisingTraceFuncTestCase.test_exceptioncs^dd����fdd��t���z
��Wn$tk
rNddl}|��YnX|�d�dS)NcSstd�D]}t|�qdS)Nr,)r8�print)rWrrr
r�1sz4RaisingTraceFuncTestCase.test_trash_stack.<locals>.fcs&|dkr"|j�jjdkr"td���S)Nr%r+z
i am crashing)rjr�r�rO)rg�why�extra�r��grr
r�5s
�z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.grzexception not propagated)rFrGrOruZcollectr�)rrurr�r
�test_trash_stack0s

z)RaisingTraceFuncTestCase.test_trash_stackc	s^dd�}��fdd��t��}z.t���z
|�Wntk
rHYnXW5t�|�XdS)NcSsd}|jdS)Nr)Zno_such_attrr(rrr
r�Gsz<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.fcs"|dkr|\}}}��|t��Sr�)ZassertIsInstancerA)rgrmrn�typerErk�r�rrr
r�Ks
z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g)rFrzrG�AttributeError)rr�Zexistingrr�r
�test_exception_argumentsFs


z1RaisingTraceFuncTestCase.test_exception_argumentsN)
rrrr{rkr�r�r�r�r�r�r�r�rrrr
r�s	r�c@seZdZddd�Zdd�ZdS)	�
JumpTracerr%FcCs6|j|_||_||_||_|r"dn|jj|_d|_dS)NF)r��code�jumpFrom�jumpTormr��	firstLine�done)r�functionr�r�rm�	decoratedrrr
rdszJumpTracer.__init__cCs�|jr
dS|jdkr4|j|jkr4|dkr4|jd|_||jkr�|jr�|j|j|jkr�|}|dk	rv|j|jkrv|j}qZ|dk	r�z|j|j|_Wnt	k
r�|j|_YnXd|_|j
S)Nr%r T)r�r��f_coder�rjrmr�rIr��	TypeErrorrk)rrgrmrnr�rrr
rkms&��zJumpTracer.traceN)r%F)rrrrrkrrrr
r�as�
	r�c
CsHz|�d�Wn4tk
rB}z|�dt|�k�W5d}~XYnXdS)Nr+Zinteger)rr�r��rr�rrr
�no_jump_to_non_integers�sr�c
CsTzt��j}|j|_Wn0tk
rF}zdt|�kr6�W5d}~XYn
Xtd��dS)Nrkz'Trace-function-less jump failed to fail)rFrHrIrjr�r��AssertionError)Zprevious_framer�rrr
�no_jump_without_trace_function�s
r�c@s�eZdZdd�Zdd�Zd�dd	�Zd�d
d�Zd�dd
�Zd�dd�Zedddg�dd��Z	edddddg�dd��Z
eddddg�dd��Zeddddddddddg�dd��Zeddddg�dd ��Z
eddddddddg�d!d"��Zedddg�d#d$��Zedddddg�d%d&��Zedd'dd'g�d(d)��Zeddddged*f�d+d,��Zedd-dd-ged*f�d.d/��Zedd-ddd0g�d1d2��Zeddddg�d3d4��Zeddddg�d5d6��Zeddddddg�d7d8��Zeddddg�d9d:��Zeddddg�d;d<��Zedddddddd=g�d>d?��Zedddddddd=g�d@dA��Zedddg�dBdC��Zeddddddg�dDdE��Zedddg�dFdG��Zedddddg�dHdI��Z edddddJg�dKdL��Z!edddddg�dMdN��Z"eddddddOg�dPdQ��Z#eddddddOg�dRdS��Z$eddddddg�dTdU��Z%eddddddg�dVdW��Z&eddddddd=dg�dXdY��Z'eddddddd=dg�dZd[��Z(eddddddg�d\d]��Z)eddddddg�d^d_��Z*edJd-dddd-d0g�d`da��Z+edddddg�dbdc��Z,edddddg�ddde��Z-edddddJd'g�dfdg��Z.eddJdddJdhd-dig�djdk��Z/eddddJg�dldm��Z0eddddJg�dndo��Z1edddge2dpf�dqdr��Z3edd=dge2dsf�dtdu��Z4edddge2dvf�dwdx��Z5edddge2dvf�dydz��Z6edddge2dvf�d{d|��Z7edddge2dvf�d}d~��Z8eddge2df�d�d���Z9eddge2df�d�d���Z:eddddge2df�d�d���Z;eddddge2df�d�d���Z<eddge2df�d�d���Z=eddge2df�d�d���Z>eddddd�ge2df�d�d���Z?eddddd�ge2df�d�d���Z@eddge2df�d�d���ZAeddddge2df�d�d���ZBeddge2df�d�d���ZCedddge2df�d�d���ZDedddge2df�d�d���ZEeddge2d�f�d�d���ZFedddddge2d�f�d�d���ZGeddddge2d�f�d�d���ZHeddge2d�f�d�d���ZIeddge2d�f�d�d���ZJedddddge2d�f�d�d���ZKedddge2d�f�d�d���ZLedddddge2d�f�d�d���ZMedddddge2d�f�d�d���ZNeddddd=ge2df�d�d���ZOeddddd=ge2df�d�d���ZPeddddge2d�f�d�d���ZQeddddge2df�d�d���ZReddddge2df�d�d���ZSd�d��ZTd�d��ZUd�d��ZVd�dÄZWedddgd�e2d�fdƍd�dȄ�ZXedddgd�e2d�fdƍd�d̄�ZYedddgd�e2d�fdƍd�dτ�ZZedddgd�e2d�fdƍd�d҄�Z[dS)��JumpTestCasecCs |�tjt���t�d�dSrr�rrrr
r{�szJumpTestCase.setUpcCs.||kr*|�dt|�ddt|��dS)NzOutputs don't match:
Expected: r�z
Received: )r��repr)r�expectedZreceivedrrr
�compare_jump_output�s����z JumpTestCase.compare_jump_outputNr%Fc
	Csjt|||||�}t�|j�g}	|dkr2||	�n|j|��||	�W5QRXt�d�|�||	�dSr)r�rFrGrk�assertRaisesRegexr��
rr�r�r�r��errorrmr�r�rrrr
r��s

zJumpTestCase.run_testc
	Cs�t|||||�}t�|j�g}	|dkr8t�||	��n$|j|��t�||	��W5QRXt�d�t�d�|�||	�dSr)	r�rFrGrk�asyncio�runr�Zset_event_loop_policyr�r�rrr
�run_async_test�s

zJumpTestCase.run_async_testcs�����fdd�}|S)Ncs"t��������fdd��}|S)Nc	s|j������dd�dS�NT)r�rmr�)r�r�r�rmr�r�r�r�rr
�test�s
�z7JumpTestCase.jump_test.<locals>.decorator.<locals>.testr�r�r��r�rmr�r�r��r�r
�	decorator�sz)JumpTestCase.jump_test.<locals>.decoratorr�r�r�r�r�rmr�rr�r
�	jump_test�szJumpTestCase.jump_testcs�����fdd�}|S)Ncs"t��������fdd��}|S)Nc	s|j������dd�dSr�)r�rr�rr
r��s
�z=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.testrr�r�r�r
r��sz/JumpTestCase.async_jump_test.<locals>.decoratorrr�rr�r
�async_jump_test�szJumpTestCase.async_jump_testr r4cCs"|�d�|�d�|�d�dS�Nr r+r4�r�rrrr
�test_jump_simple_forwards�s

z&JumpTestCase.test_jump_simple_forwardsr+cCs|�d�|�d�dSr6r�r�rrr
�test_jump_simple_backwards�s
z'JumpTestCase.test_jump_simple_backwardsr,cCs6dD]"}|�d�dD]}|�d�qq|�d�dS)N�r r+r+�r4r0r,r��rrW�jrrr
�test_jump_out_of_block_forwards�s

z,JumpTestCase.test_jump_out_of_block_forwardsr;r1cCsJ|�d�dD],}|�d�dD]}|�d�q |�d�q|�d�dS)Nr rrr4)r+r,r;r1r�rrrr
� test_jump_out_of_block_backwards�s

z-JumpTestCase.test_jump_out_of_block_backwardsr0c�sHdD]>}tddg�2z 3dHW}|�d�|�d�q6|�d�qdS)Nrrr r+r4r0r,�rr�rrWrrr
�)test_jump_out_of_async_for_block_forwards�s

z6JumpTestCase.test_jump_out_of_async_for_block_forwardsc�sPdD]F}|�d�tdg�2z 3dHW}|�d�|�d�q6|�d�qdS)Nrrr+r r0r,r;�rrrrrr
�*test_jump_out_of_async_for_block_backwardss

z7JumpTestCase.test_jump_out_of_async_for_block_backwardscCs|�d�|�d�dS)Nr r4r�r�rrr
�test_jump_to_codeless_lines
z'JumpTestCase.test_jump_to_codeless_linecCs"|�d�|�d�|�d�dSr�r�r�rrr
�test_jump_to_same_lines

z#JumpTestCase.test_jump_to_same_line�	cCsFz|�d�W5|�d�z|�d�W5|�d�X|�d�XdS)Nr0�r;r
r+r�r�rrr
�test_jump_in_nested_finallys
z(JumpTestCase.test_jump_in_nested_finally�c	Cs@z|�d�ddW�dS|�d�|�d�X|�d�dS)Nr;r1r+r rrr�r�rrr
�test_jump_in_nested_finally_2$s

z*JumpTestCase.test_jump_in_nested_finally_2�cCs\z|�d�ddW�dS|�d�z|�d�W5|�d�X|�d�X|�d�dS)	Nr;r[rrr+r r�r�r�rrr
�test_jump_in_nested_finally_3/s

z*JumpTestCase.test_jump_in_nested_finally_3rc
Cs\dz|�d�W5|�d�|�d��dSz|�d�W5|�d�XX|�d�dS)Nr0r,r[rr+rr�r�rrr
�2test_jump_over_return_try_finally_in_finally_block>s

z?JumpTestCase.test_jump_over_return_try_finally_in_finally_blockcCs$|�d�|�d�q
|�d�dS)Nr r4r0r�r�rrr
�test_jump_infinite_while_loopMs
z*JumpTestCase.test_jump_infinite_while_loopcCs.d}|�d�|dkr*|�d�|d7}qdS)Nr r+r0r�rrrr
�#test_jump_forwards_into_while_blockTs


z0JumpTestCase.test_jump_forwards_into_while_blockcCs.d}|dkr |�d�|d7}q|�d�dS)Nr r+r4r,r�rrrr
�$test_jump_backwards_into_while_block\s


z1JumpTestCase.test_jump_backwards_into_while_blockc	Cs.t|d��|�d�W5QRX|�d�dSr��rrr�rrr
�$test_jump_forwards_out_of_with_blockdsz1JumpTestCase.test_jump_forwards_out_of_with_blockc
�s<t|d�4IdH�|�d�W5QIdHRX|�d�dSr��rrr�rrr
�*test_jump_forwards_out_of_async_with_blockjsz7JumpTestCase.test_jump_forwards_out_of_async_with_blockr@c	Cs.|�d�t|d��|�d�W5QRXdSr��rrr�rrr
�%test_jump_backwards_out_of_with_blockps
z2JumpTestCase.test_jump_backwards_out_of_with_blockc
�s<|�d�t|d�4IdH�|�d�W5QIdHRXdSr��rrr�rrr
�+test_jump_backwards_out_of_async_with_blockvs
z8JumpTestCase.test_jump_backwards_out_of_async_with_blockc	Cs*z|�d�W5|�d�X|�d�dS�Nr0r+r,r�r�rrr
�+test_jump_forwards_out_of_try_finally_block|sz8JumpTestCase.test_jump_forwards_out_of_try_finally_blockc	Cs*|�d�z|�d�W5|�d�XdS�Nr r,r4r�r�rrr
�,test_jump_backwards_out_of_try_finally_block�s
z9JumpTestCase.test_jump_backwards_out_of_try_finally_blockcCs6z|�d�Wn|�d��YnX|�d�dS�Nr+r0r;r�r�rrr
�*test_jump_forwards_out_of_try_except_block�s
z7JumpTestCase.test_jump_forwards_out_of_try_except_blockcCs6|�d�z|�d�Wn|�d��YnXdS�Nr r4r,r�r�rrr
�+test_jump_backwards_out_of_try_except_block�s

z8JumpTestCase.test_jump_backwards_out_of_try_except_blockrcCs`zddWnDtk
r4|�d�|�d�Yntk
rP|�d�YnX|�d�dS�Nr rr0r,r1r��ZeroDivisionErrorr�FloatingPointErrorr�rrr
�test_jump_between_except_blocks�s
z,JumpTestCase.test_jump_between_except_blockscCsFzddWn*|�d�|�d�|�d�YnX|�d�dS)Nr rr0r,r;r1r�r�rrr
�test_jump_within_except_block�s

z*JumpTestCase.test_jump_within_except_blockr_c	CsN|�d�t|d��|�d�W5QRXt|d��|�d�W5QRXdS�Nr r+r4r0r,rr�rrr
�test_jump_across_with�s

z"JumpTestCase.test_jump_across_withc
�sj|�d�t|d�4IdH�|�d�W5QIdHRXt|d�4IdH�|�d�W5QIdHRXdSr/rr�rrr
�test_jump_across_async_with�s

z(JumpTestCase.test_jump_across_async_withc
CsL|�d�dD].}t|d��|�d�W5QRX|�d�q|�d�dS�Nr rrr4r0r,r;rrrrr
�,test_jump_out_of_with_block_within_for_block�s
z9JumpTestCase.test_jump_out_of_with_block_within_for_blockc�sZ|�d�dD]<}t|d�4IdH�|�d�W5QIdHRX|�d�q|�d�dSr2rrrrr
�2test_jump_out_of_async_with_block_within_for_block�s
z?JumpTestCase.test_jump_out_of_async_with_block_within_for_blockc
CsX|�d�t|d��0t|d��|�d�W5QRX|�d�W5QRX|�d�dS�Nr r+r4r0r,r;rr�rrr
�-test_jump_out_of_with_block_within_with_block�s
z:JumpTestCase.test_jump_out_of_with_block_within_with_blockc�sf|�d�t|d��>t|d�4IdH�|�d�W5QIdHRX|�d�W5QRX|�d�dSr5)rrrr�rrr
�3test_jump_out_of_async_with_block_within_with_block�s
z@JumpTestCase.test_jump_out_of_async_with_block_within_with_blockcCsJz|�d�W5t|d��|�d�W5QRX|�d�X|�d�dS�Nr0r,r;r+r1rr�rrr
�0test_jump_out_of_with_block_within_finally_block�sz=JumpTestCase.test_jump_out_of_with_block_within_finally_blockc�sXz|�d�W5t|d�4IdH�|�d�W5QIdHRX|�d�X|�d�dSr8rr�rrr
�6test_jump_out_of_async_with_block_within_finally_block�szCJumpTestCase.test_jump_out_of_async_with_block_within_finally_blockcCsp|�d�dD]R}|�d�dD]4}|�d�zdD]}|�d�q4W5|�d�Xq |�d�q|�d	�dS)
Nr rrr4rr,r[rrrr�)rrWr�krrr
�&test_jump_out_of_complex_nested_blocks�s


z3JumpTestCase.test_jump_out_of_complex_nested_blocksc	Cs8|�d�t|d��}|�d�W5QRX|�d�dS�Nr r+r0r,r�rrrrr
� test_jump_out_of_with_assignment
s


z-JumpTestCase.test_jump_out_of_with_assignmentc
�sF|�d�t|d�4IdH�}|�d�W5QIdHRX|�d�dSr=rr>rrr
�&test_jump_out_of_async_with_assignments

z3JumpTestCase.test_jump_out_of_async_with_assignmentc	CsJ|�d�z$|�d�|s"W�dS|�d�W5|�d�X|�d�dS)Nr rr4r;r
r�r�rrr
�*test_jump_over_return_in_try_finally_blocks

z7JumpTestCase.test_jump_over_return_in_try_finally_blockr[�
c	Cs`|�d�|�d�z"|�d�|s*W�qR|�d�W5|�d�X|�d�qRq
|�d�dS)Nr r4r[r,rrrBr�r�rrr
�)test_jump_over_break_in_try_finally_block&s



z6JumpTestCase.test_jump_over_break_in_try_finally_blockcCsF|�d�|s$dD]}|�d�qn|�d�|�d�|�d�dS�Nr rr0r;r1rr�rrrr
�$test_jump_over_for_block_before_else6s


z1JumpTestCase.test_jump_over_for_block_before_elsec�sV|�d�|s4tdg�2z3dHW}|�d�q6n|�d�|�d�|�d�dS�Nr r4r0r;r1rr	rrrr
�*test_jump_over_async_for_block_before_elseAs


z7JumpTestCase.test_jump_over_async_for_block_before_elseZaftercCs|�d�|�d�dSr6r�r�rrr
�test_no_jump_too_far_forwardsNs
z*JumpTestCase.test_no_jump_too_far_forwards�beforecCs|�d�|�d�dSr6r�r�rrr
�test_no_jump_too_far_backwardsSs
z+JumpTestCase.test_no_jump_too_far_backwards�exceptcCs,z|�d�Wn|�d��YnXdS�Nr+r0r�r�rrr
�test_no_jump_to_except_1Ys

z%JumpTestCase.test_no_jump_to_except_1cCs4z|�d�Wn tk
r.|�d��YnXdSrL�rr�r�rrr
�test_no_jump_to_except_2as

z%JumpTestCase.test_no_jump_to_except_2c
CsDz|�d�Wn0tk
r>}z|�d�|�W5d}~XYnXdSrLrNr�rrr
�test_no_jump_to_except_3is

z%JumpTestCase.test_no_jump_to_except_3c
CsHz|�d�Wn4ttfk
rB}z|�d�|�W5d}~XYnXdSrL)rr�rOr�rrr
�test_no_jump_to_except_4qs

z%JumpTestCase.test_no_jump_to_except_4ZintocCs"|�d�dD]}|�d�qdS)Nr rr4r�rrrr
�$test_no_jump_forwards_into_for_blockys
z1JumpTestCase.test_no_jump_forwards_into_for_blockc�s4|�d�tddg�2z3dHW}|�d�q6dSr�r	rrrr
�*test_no_jump_forwards_into_async_for_blocks
z7JumpTestCase.test_no_jump_forwards_into_async_for_blockcCs"dD]}|�d�q|�d�dS)Nrr+r4r�rrrr
�%test_no_jump_backwards_into_for_block�sz2JumpTestCase.test_no_jump_backwards_into_for_blockc�s4tddg�2z3dHW}|�d�q6|�d�dSr�rrrrr
�+test_no_jump_backwards_into_async_for_block�sz8JumpTestCase.test_no_jump_backwards_into_async_for_blockc	Cs.|�d�t|d��|�d�W5QRXdSr�rr�rrr
�%test_no_jump_forwards_into_with_block�s
z2JumpTestCase.test_no_jump_forwards_into_with_blockc
�s<|�d�t|d�4IdH�|�d�W5QIdHRXdSr�rr�rrr
�+test_no_jump_forwards_into_async_with_block�s
z8JumpTestCase.test_no_jump_forwards_into_async_with_blockr`c	Cs.t|d��|�d�W5QRX|�d�dSr�rr�rrr
�&test_no_jump_backwards_into_with_block�sz3JumpTestCase.test_no_jump_backwards_into_with_blockc
�s<t|d�4IdH�|�d�W5QIdHRX|�d�dSr�rr�rrr
�,test_no_jump_backwards_into_async_with_block�sz9JumpTestCase.test_no_jump_backwards_into_async_with_blockc	Cs*|�d�z|�d�W5|�d�XdSr#r�r�rrr
�,test_no_jump_forwards_into_try_finally_block�s
z9JumpTestCase.test_no_jump_forwards_into_try_finally_blockc	Cs*z|�d�W5|�d�X|�d�dSr!r�r�rrr
�-test_no_jump_backwards_into_try_finally_block�sz:JumpTestCase.test_no_jump_backwards_into_try_finally_blockcCs6|�d�z|�d�Wn|�d��YnXdSr'r�r�rrr
�+test_no_jump_forwards_into_try_except_block�s

z8JumpTestCase.test_no_jump_forwards_into_try_except_blockcCs6z|�d�Wn|�d��YnX|�d�dSr%r�r�rrr
�,test_no_jump_backwards_into_try_except_block�s
z9JumpTestCase.test_no_jump_backwards_into_try_except_blockc
CsnzddWnRtk
r4|�d�|�d�Yn,tk
r^}z|�d�W5d}~XYnX|�d�dSr)r*r�rrr
�$test_no_jump_between_except_blocks_2�s
z1JumpTestCase.test_no_jump_between_except_blocks_2zinto a 'finally'c	Cs*|�d�z|�d�W5|�d�XdSr#r�r�rrr
�test_no_jump_into_finally_block�s
z,JumpTestCase.test_no_jump_into_finally_blockc	Cs>z|�d�|�d�W5|�d�|�d�X|�d�dS)Nr,r;r+r4r1r�r�rrr
�.test_no_jump_into_finally_block_from_try_block�s

z;JumpTestCase.test_no_jump_into_finally_block_from_try_blockzout of a 'finally'c	Cs*|�d�z|�d�W5|�d�XdSr#r�r�rrr
�!test_no_jump_out_of_finally_block�s
z.JumpTestCase.test_no_jump_out_of_finally_blockzinto an 'except'cCs4|�d�z|�d�Wn|�d�YnXdSr'r�r�rrr
�#test_no_jump_into_bare_except_block�s

z0JumpTestCase.test_no_jump_into_bare_except_blockcCs<|�d�z|�d�Wntk
r6|�d�YnXdSr'�rrAr�rrr
�(test_no_jump_into_qualified_except_block�s

z5JumpTestCase.test_no_jump_into_qualified_except_blockcCsJz|�d�|�d�Wn"|�d�|�d��YnX|�d�dS�Nr+r4r,r;rr�r�rrr
�2test_no_jump_into_bare_except_block_from_try_blocks


z?JumpTestCase.test_no_jump_into_bare_except_block_from_try_blockcCsRz|�d�|�d�Wn*tk
rB|�d�|�d��YnX|�d�dSre)rr+r�rrr
�7test_no_jump_into_qualified_except_block_from_try_blocks


zDJumpTestCase.test_no_jump_into_qualified_except_block_from_try_blockzout of an 'except'cCsF|�d�z|�d�ddWn |�d�|�d�YnXdS�Nr r4rr;r1r�r�rrr
�%test_no_jump_out_of_bare_except_blocks


z2JumpTestCase.test_no_jump_out_of_bare_except_blockcCsN|�d�z|�d�ddWn(tk
rH|�d�|�d�YnXdSrhrcr�rrr
�*test_no_jump_out_of_qualified_except_block!s


z7JumpTestCase.test_no_jump_out_of_qualified_except_blockc	CsN|�d�t|d��|�d�W5QRXt|d��|�d�W5QRXdSr/rr�rrr
� test_no_jump_between_with_blocks+s

z-JumpTestCase.test_no_jump_between_with_blocksc
�sj|�d�t|d�4IdH�|�d�W5QIdHRXt|d�4IdH�|�d�W5QIdHRXdSr/rr�rrr
�&test_no_jump_between_async_with_blocks3s

z3JumpTestCase.test_no_jump_between_async_with_blocks�finallyc
Cs<dz|�d�W5|�d�|�d��dSX|�d�)Nr0r,r+r1r�r�rrr
�-test_no_jump_over_return_out_of_finally_block;s

z:JumpTestCase.test_no_jump_over_return_out_of_finally_blockcCsF|�d�|s$dD]}|�d�qn|�d�|�d�|�d�dSrDr�rrrr
�'test_no_jump_into_for_block_before_elseEs


z4JumpTestCase.test_no_jump_into_for_block_before_elsec�sV|�d�|s4tdg�2z3dHW}|�d�q6n|�d�|�d�|�d�dSrFr	rrrr
�-test_no_jump_into_async_for_block_before_elsePs


z:JumpTestCase.test_no_jump_into_async_for_block_before_elsecCs|�tdddg�dS)Nr+ZSpamT)r�r�rrrr
�test_no_jump_to_non_integers[sz)JumpTestCase.test_no_jump_to_non_integerscCs
t�dSr)r�rrrr
�#test_no_jump_without_trace_function^sz0JumpTestCase.test_no_jump_without_trace_functioncCs0i}tdd|�|d}|�|dddg�dS)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�r+i�r)r�r�)r�dr�rrr
�test_large_functioncs��	z JumpTestCase.test_large_functioncsptddd��G�fdd�d�}t|dd�}t�|j�dgi}t�|�t�d�|�dd	dd	d
g|d�dS)Nzd
# Comments don't count.
output.append(2)  # firstlineno is here.
output.append(3)
output.append(4)
z
<fake module>r�cseZdZ�ZdS)z<JumpTestCase.test_jump_to_firstlineno.<locals>.fake_functionN)rrrr�r�r�rr
�
fake_function{srvr+rrr4r0)�compiler�rFrGrkr�r�)rrvr�r�rrur
�test_jump_to_firstlinenoqs�

z%JumpTestCase.test_jump_to_firstlinenor#z5can't jump from the 'call' trace event of a new frame)rmr�cs*��d��fdd�}|���d�dS)Nr cs��d�dS)Nr4r�rr�rr
�nested�sz3JumpTestCase.test_no_jump_from_call.<locals>.nestedr,r�)rryrr�r
�test_no_jump_from_call�s
z#JumpTestCase.test_no_jump_from_callr'z'can only jump from a 'line' trace eventcCs|�d�dSrr�r�rrr
�test_no_jump_from_return_event�s
z+JumpTestCase.test_no_jump_from_return_eventrEcCs|�d�dddS)Nr rr�r�rrr
�!test_no_jump_from_exception_event�s
z.JumpTestCase.test_no_jump_from_exception_eventz!can't jump from a yield statementcs$�fdd�}t|����d�dS)Nc3s��d�dVdS)Nr+r4r�rr�rr
�gen�s
z1JumpTestCase.test_no_jump_from_yield.<locals>.genr,)�nextr)rr}rr�r
�test_no_jump_from_yield�s
z$JumpTestCase.test_no_jump_from_yield)Nr%F)Nr%F)Nr%)Nr%)\rrrr{r�r�r�r�r�r�r�rrrr
rrrr+rrrrrrrrrr r"r$r&r(r-r.r0r1r3r4r6r7r9r:r<r?r@rArCrErGr�rHrJrMrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrdrfrgrirjrkrlrnrorprqrrrtrxrzr{r|rrrrr
r��s`�

�






	






















	






	
	

























	



	







	
	


	




�
�
�r��__main__).r�rZunittestrFr�ru�	functoolsrr�rrrr!rdr)r-r.r2r:r=r>r#rBrDrMrNrPrQrSrXrYrZr]raZTestCasertr�Zcpython_onlyr�r�r�r�r�r�r�mainrrrr
�<module>sP�
��	�	������
�		�
�
�

��$`&