Sindbad~EG File Manager
�
'Μg;R��
�ddlmZddlZddlZddlZddlZddlmZddlZddl m
Z
ddlZddlZejd��Gd�d�ZGd �d
�Zd�Zd�Zd
�Zgd�e_d�Zgd�e_d�Zgd�e_d�Zgd�e_d�Zgd�e_d�Zgd�e_d�Zgd�e_d�Zd�Zgd�e_d�Zd�Zgd�e_d �Zd!�Zd"ge_d#�Z d$�Z!gd%�e!_d&�Z"gd'�e"_d(�Z#gd)�e#_d*�Z$gd+�e$_d,�Z%d-�Z&gd.�d/d0gd1zzd/d2gze&_Gd3�d4�Z'Gd5�d6ejP�Z)gd7�Z*Gd8�d9e)�Z+ejXGd:�d;e)��Z-Gd<�d=ejP�Z.Gd>�d?�Z/d@�Z0dA�Z1GdB�dCejP�Z2GdD�dEejP�Z3GdF�dGejP�Z4GdH�dIe)�Z5GdJ�dKe)�Z6e7dLk(rejp�yy)M�)�supportN��wraps)�
import_helperT)�modulec�"�eZdZdZd�Zd�Zd�Zy)�tracecontextz/Context manager that traces its enter and exit.c� �||_||_y�N��output�value��selfr
rs �3/usr/local/lib/python3.12/test/test_sys_settrace.py�__init__ztracecontext.__init__��������
�c�N�|jj|j�yr�r
�appendr�rs r� __enter__ztracecontext.__enter__s�������4�:�:�&rc�P�|jj|j�yrr�r�exc_infos r�__exit__ztracecontext.__exit__s�������D�J�J�;�'rN)�__name__�
__module__�__qualname__�__doc__rrr�rrr r s��9��'�(rr c�"�eZdZdZd�Zd�Zd�Zy)�asynctracecontextz>Asynchronous context manager that traces its aenter and aexit.c� �||_||_yrrrs rrzasynctracecontext.__init__rrc��VK�|jj|j�y�wrrrs r�
__aenter__zasynctracecontext.__aenter__"s���������4�:�:�&�s�')c��XK�|jj|j�y�wrrrs r� __aexit__zasynctracecontext.__aexit__%s���������D�J�J�;�'�s�(*N)rrr r!rr'r)r"rrr$r$s��H��'�(rr$c�$K�|D]}|���� y�w)z0Convert an iterable to an asynchronous iterator.Nr")�iterable�xs r� asynciterr-(s����
�����s�c�.��t���fd��}|S)Nc�����K�g��fd�} �|i|�d|i���d{����r!�j���d{����r� SS7�'7�#�r"�j���d{���7�r�!wwxYw�w)Nc�T��t|�}�j|j�|Sr)r-r�aclose)r+�it�cleanupss �r�wrapped_asynciterz;clean_asynciter.<locals>.wrapper.<locals>.wrapped_asynciter1s"����8�$�B��O�O�B�I�I�&��Irr-��pop)�args�kwargsr4r3�tests @�r�wrapperz clean_asynciter.<locals>.wrapper.ss������� � '��t�K�v�K�9J�K�K��$�h�l�l�n�&�&�&��L��'���$�h�l�l�n�&�&�&��sS�A1�A�A�A�A1�A�A1�A1�A�A1�A.�#A&�$A.�,A.�.A1r)r9r:s` r�clean_asynciterr;-s ���
�4�[�
'��
'��Nrc��y�N�r"r"rr�basicr?=s��r)�r�call�r>�line�r>�returnc��d}~ d}yr=r"�r,s r�arigo_example0rHLs�� �A� �
� �Ar)r@rB��rC��rC��rC�rNrEc��d}~ d}yr=r"rGs r�arigo_example1rQZs�� �A� �� �Arc��d}~ d}yr=r"rGs r�arigo_example2rShs�� �A� ��
��r)r@rBrIrK��rC��rC�rWrEc��d}~d}yr=r"rGs r�one_instr_linerZ{s�� �A� � �Ar�r@rBrIrK�rLrEc�6�d}td�D] }|rd}�d}�y�Nr>rJ��range)r,�as r�no_pop_topsrb�s"�� �A�
�1�X����A��A� r)
r@rBrIrK��rCrIrKrTrI�rJrEc�"�d}|s t|s� d}yr=)�bla)�yr,s r�
no_pop_blocksri�s�� �A���� �Ar�r@rBrIrT�rUrEc��d}yr=r"rGs r�calledrm�s�� �Arc��t�yr)rmr"rrrArA�s��
�Hr)r@rB����rA����rC�rrrErDc��t�r�� Exceptionr"rr�raisesrw�s��
�Orc�8� t�y#t$rYywxYwr)rwrvr"rr�
test_raisery�s��
�����
��
�s�
� �)r@rBrIrorq�rr� exceptionrs�rJr{rKrTrkc�t�tj|�|tj�j_yr)�sys�settrace� _getframe�f_back�f_trace�� tracefuncs r�_settrace_and_returnr��s"���L�L���%.�C�M�M�O���"rc��t|�yr)r�r�s r�settrace_and_returnr��s
����#rrDc�~�tj|�|tj�j_t
�r)r~rr�r�r��RuntimeErrorr�s r�_settrace_and_raiser��s(���L�L���%.�C�M�M�O���"�
�rc�:� t|�y#t$rYywxYwr)r�r�r�s r�settrace_and_raiser��s!��
��I�&���
��
�s�� �)r|rKrTrkc�"�d}d}||k(r|dz}yy)NrNr>r")ra�bs r�ireturn_exampler��s�� �A� �A��A�v�
�a�C��r�r@rBrIrKrTrkc�V�tdd�} d} ||}|dz
}�#t$rYywxYw)NrrLr>�r`�
IndexError)�items�ir�s r�tightloop_exampler��sB���!�Q�K�E�
�
����a��A�!�Q�$�!����
��
�s�� (�()r@rBrIrKrTrMrTrMrTrMrTrM)rNr{rcrVrXc�J�tdd�} d}||}�#t$rYywxYw)Nr>rUrr�)r�r�s r�tighterloop_exampler�s4���!�Q�K�E�
�
���1�X��a���
��
�s�� "�")r@rBrIrKrTrTrTrT)rUr{rMrc�rdrEc#�"K� d�� y#wxYw�w�NTr"r"rr�generator_functionr�%s������
���� �s��
���c�N�tt��}td�D]}|}�y)N�
)�anyr�r`)r,rhs r�generator_exampler�+s%���� �!�A��2�Y��
��r)
r@rI����rA����rC����rC�r�rE)r�rA�r�r{����rC�r�rErMrcr�rOc�&�eZdZdd�Zd�Zd�Zd�Zy)�TracerNc�.�||_||_g|_yr)�trace_line_events�trace_opcode_events�events)rr�r�s rrzTracer.__init__Bs��!2���#6�� ���rc�z�|j�|j|_|j�|j|_yyr)r��
f_trace_linesr��f_trace_opcodes)r�frames r�_reconfigure_framezTracer._reconfigure_frameGs;���!�!�-�"&�"8�"8�E���#�#�/�$(�$<�$<�E�!�0rc��|j|�|jj|j|f�|jSr�r�r�r�f_lineno�trace�rr��event�args rr�zTracer.traceMs5������&������E�N�N�E�2�3��z�z�rc��|j|�d�dD�|jj|j|f�|jS)Nc3� K�|]}|���y�wrr")�.0�os r� <genexpr>z)Tracer.traceWithGenexp.<locals>.<genexpr>Ts�����C�q��C�s��r>r�r�s r�traceWithGenexpzTracer.traceWithGenexpRs=������&��C�������E�N�N�E�2�3��z�z�r)NN)rrr rr�r�r�r"rrr�r�As���
=��
rr�c��eZdZd�Zd�Zed��Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d(�Z+d)�Z,d*�Z-d+�Z.d,�Z/d-�Z0d.�Z1d/�Z2d0�Z3d1�Z4d2�Z5d3�Z6d4�Z7d5�Z8d6�Z9d7�Z:d8�Z;d9�Z<d:�Z=d;�Z>d<�Z?d=�Z@d>�ZAd?�ZBd@�ZCdA�ZDdB�ZEdC�ZFdD�ZGdE�ZHeIj�dF��ZKdG�ZLeIj�dH��ZMdI�ZNyJ)K�
TraceTestCasec���tj�|_tj�|j t
jtj��yr)�gc� isenabled�using_gc�disable�
addCleanupr~r�gettracers r�setUpzTraceTestCase.setUp]s0�������
�
�
�
��������c�l�l�n�5rc�F�|jrtj�yyr)r�r��enablers r�tearDownzTraceTestCase.tearDownbs���=�=��I�I�K�rc��t�S)z@Helper to allow test subclasses to configure tracers differently�r�r"rr�make_tracerzTraceTestCase.make_tracerfs���x�rc�4�|D��cgc]\}}|�||z
nd|f��}}}||k7rf|jddjtj|D�cgc]
}t |���c}|D�cgc]
}t |���c}��z�yycc}}wcc}wcc}w)Nz"events did not match expectation:
�
)�fail�join�difflib�ndiff�str)r�line_offsetr��expected_events�l�er,s r�compare_eventszTraceTestCase.compare_eventsks���PV�W�PV�f�q�!�a�m�1�{�?��q�A�PV��W��_�$��I�I�5�� � �'�-�-��(I��A��Q���(I�9?�(@��A��Q���(@�B�C�C�
D�%��X��)J��(@s�B
�
B�%Bc��|j�}tj|j�|�tjd�|j |j
j|j|�yr)r�r~rr�r��__code__�co_firstlinenor�)r�funcr��tracers r�run_and_comparezTraceTestCase.run_and_comparessT���!�!�#�����V�\�\�"������T�����D�M�M�8�8�"�M�M�6� 3rc�<�|j||j�yr)r�r��rr�s r�run_testzTraceTestCase.run_test{s�����T�4�;�;�/rc���|j�}||j�tjd�|j |j
j|j|j�yr)r�r�r~rr�r�r�r�)rr�r�s r� run_test2zTraceTestCase.run_test2~sO���!�!�#���V�\�\�����T�����D�M�M�8�8�"�M�M�4�;�;� 8rc�Z�tjd�tj��J�yr�r~rr�rs r�test_set_and_retrieve_nonez(TraceTestCase.test_set_and_retrieve_none�s �����T���|�|�~�%�%�%rc���d�}tj|� tj�|usJ� tjd�y#tjd�wxYw)Nc��yrr"�r7s r�fnz4TraceTestCase.test_set_and_retrieve_func.<locals>.fn����rr�)rr�s r�test_set_and_retrieve_funcz(TraceTestCase.test_set_and_retrieve_func�sG�� � ���R�� ��<�<�>�R�'�'�'��L�L����C�L�L���s�A � A c�.�|jt�yr)r�r?rs r�
test_01_basiczTraceTestCase.test_01_basic�s���
�
�e�rc�.�|jt�yr)r�rHrs r�test_02_arigo0zTraceTestCase.test_02_arigo0�����
�
�n�%rc�.�|jt�yr)r�rQrs r�test_02_arigo1zTraceTestCase.test_02_arigo1�r�rc�.�|jt�yr)r�rSrs r�test_02_arigo2zTraceTestCase.test_02_arigo2�r�rc�.�|jt�yr)r�rZrs r�test_03_one_instrzTraceTestCase.test_03_one_instr�r�rc�.�|jt�yr)r�rirs r�test_04_no_pop_blocksz#TraceTestCase.test_04_no_pop_blocks�s���
�
�m�$rc�.�|jt�yr)r�rbrs r�test_05_no_pop_topsz!TraceTestCase.test_05_no_pop_tops�s���
�
�k�"rc�.�|jt�yr)r�rArs r�test_06_callzTraceTestCase.test_06_call�s���
�
�d�rc�.�|jt�yr)r�ryrs r�
test_07_raisezTraceTestCase.test_07_raise�s���
�
�j�!rc�.�|jt�yr)r�r�rs r�test_08_settrace_and_returnz)TraceTestCase.test_08_settrace_and_return�s�����*�+rc�.�|jt�yr)r�r�rs r�test_09_settrace_and_raisez(TraceTestCase.test_09_settrace_and_raise�s�����)�*rc�.�|jt�yr)r�r�rs r�test_10_ireturnzTraceTestCase.test_10_ireturn�s���
�
�o�&rc�.�|jt�yr)r�r�rs r�test_11_tightloopzTraceTestCase.test_11_tightloop�s���
�
�'�(rc�.�|jt�yr)r�r�rs r�test_12_tighterloopz!TraceTestCase.test_12_tighterloop�s���
�
�)�*rc�P�|jt�|j�}tj|j
�t�tjd�|j
tjj|jtj�yr)
r�r�r�r~rr�r�r�r�r�)rr�s r�test_13_genexpzTraceTestCase.test_13_genexp�sq���
�
�'�(�
�!�!�#�����V�+�+�,������T�����-�6�6�E�E�"�M�M�+<�+C�+C� Erc�2�d�}|j|gd��y)Nc��d}y)NFrr"rGs r�onlinersz2TraceTestCase.test_14_onliner_if.<locals>.onliners�s
���Q�r)r@rBrKr\�r�)rrs r�test_14_onliner_ifz TraceTestCase.test_14_onliner_if�s�� �
����
� rc�`�d�}|j|gd��d�}|j|gd��y)Nc�$�td�D]}�y�NrJr_rGs r�for_examplez0TraceTestCase.test_15_loops.<locals>.for_example�s���1�X���r)r@rBrIrBrIrBrDc�*�d}|dkDr|dz}|dkDr�yy)NrJrr>r"rGs r�
while_examplez2TraceTestCase.test_15_loops.<locals>.while_example�s ���A��a�%��Q����a�%r)r@rIrKrTrKrTrKr\r)rrrs r�
test_15_loopszTraceTestCase.test_15_loops�s<�� �
����
� � �
����
� rc�N�i}td|�|j|dgd��y)Nadef f():
pass�f)r@)�rC)r"rE��execr�)r� namespaces r�test_16_blank_linesz!TraceTestCase.test_16_blank_lines�s,��� ��
3�Y�?�����c�N�
� rc�2�d�}|j|ddg�y)Nc�:�dtj�_d}yr)r~r�r�)�linenos rr�z0TraceTestCase.test_17_none_f_trace.<locals>.func�s��&*�C�M�M�O�#��Frr@rBrr�s r�test_17_none_f_tracez"TraceTestCase.test_17_none_f_trace�s$�� �
���T�
�
�
� rc�2�d�}|j|gd��y)Nc�T� t�#t$r}�d}~wwxYw#t$rYywxYwrru)r�r,rhs rr�z4TraceTestCase.test_18_except_with_name.<locals>.func�s7��
�$�#�O�� �$���$���
��
�s� � ���� '�')
r@rBrIrK�rLr{rTrM��rC�� rC)r1rErr�s r�test_18_except_with_namez&TraceTestCase.test_18_except_with_name�s�� �
���T�
�
rc�2�d�}|j|gd��y)Nc�B� t�#d}wxYw#t$rd}YywxYw)N� Something�ru)rhr�s rr�z7TraceTestCase.test_19_except_with_finally.<locals>.funcs+��
�$�#�O��#�A���
���
�s� �
���) r@rBrIrKr-rMrcrVrXrr�s r�test_19_except_with_finallyz)TraceTestCase.test_19_except_with_finallys�� �
���T�
� rc����Gd�d���fd���fd�}|j�}gd�} ||j�|j�jj
|j|�y#t$rY�=wxYw)Nc��eZdZd�Zd�Zd�Zy)�BTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapperc�$�t|�|_yr)�iter�_it)r�objs rrzKTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__init__*s
����9��rc��|Srr"rs r� __aiter__zLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__aiter__-����rc��\K� t|j�S#t$rt�wxYw�wr)�nextr=�
StopIteration�StopAsyncIterationrs r� __anext__zLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__anext__0s-����-�����>�)��$�-�,�,�-�s�,��,�)�,N)rrr rr@rFr"rr�AsyncIteratorWrapperr:)s��
%�
�
-rrGc��@�K��d�23d{���}|}�7�6d}y�w)N�abc�*r")�letterr,rhrGs �r�
doit_asyncz8TraceTestCase.test_20_async_for_loop.<locals>.doit_async6s)����� 4�U� ;�
�f���
�� ;��A�s� ������c�����} tj|�|jd�tjd�y#tjd�wxYwr)r~r�send)r�r,rLs �r�runz1TraceTestCase.test_20_async_for_loop.<locals>.run;s?�����A�
#����V�$����t�����T�"�����T�"�s�&A�A)(r@rB)i�rA)���rC)rPrE�i����rA����rC�rSrEr�r�r�r��r>r{rIrBr�r�r�r�rUrIrBr�r�r�r�rUrIrBr�r�r�r��rprCrqrzrsrUrKr\)r�r�rvr�r�r�r�)rrOr�r�rGrLs @@r�test_20_async_for_loopz$TraceTestCase.test_20_async_for_loop(s{��� -� -� �
#��!�!�#��(��R ������
���J�/�/�>�>�"�M�M�6� 3��� �� �s�A0�0 A<�;A<c���d���fd�}|j�}|�} tj|j�|j d�tjd�gd�}|j
|jj|j|�y#t
$rY�VwxYw#tjd�wxYw)Nc�6K�t|�D]}|���� y�wrr_)�nr�s r�arangezGTraceTestCase.test_async_for_backwards_jump_has_no_line.<locals>.arangeus�����1�X�����s�c��F�K��d�23d{���}|dkDs�y7�6y�w)NrL�dr")r�r[s �rr!zBTraceTestCase.test_async_for_backwards_jump_has_no_line.<locals>.fxs'�����!�!�9�
�a��s�7��
��9�s � !����!�!��!)r@rBrorqr�r�rUrIrB�r�rArqr�r�rUrIrBr^rqr�r�rUrIrBr^rqrsrUrD)
r�r~rr�rNrvr�r�r�r�)rr!r��coror�r[s @r�)test_async_for_backwards_jump_has_no_linez7TraceTestCase.test_async_for_backwards_jump_has_no_linets���� � �
�!�!�#���s�� ��L�L����&��I�I�d�O�
�L�L���
��<
���A�J�J�5�5�"�M�M�6� 3��G� �� ��
�L�L���s#�0B� B)�&B,�(B)�)B,�,Cc�2�d�}|j|gd��y)Nc�� yrr"r"rrr�z1TraceTestCase.test_21_repeated_pass.<locals>.func�s���r�r@rBrIrerr�s r�test_21_repeated_passz#TraceTestCase.test_21_repeated_pass�s�� �
���T�
� rc�2�d�}|j|gd��y)Nc�"� dD]}�y#YyxYw)Nr"r>rJr"�r�s rr�z3TraceTestCase.test_loop_in_try_except.<locals>.func�s��
��A����
��s�
�r[rr�s r�test_loop_in_try_exceptz%TraceTestCase.test_loop_in_try_except�s�� �
���T�
� rc�8���fd��|j�gd��y)Nc�L�� �jdk(r y y#YyxYw#wxYw�N�Fred)r�r�s�rr�z8TraceTestCase.test_try_except_no_exception.<locals>.func�sF���
������=�=�F�*���+���
�����s�!��!�!�#� r@rBrIrcrV�r�rC��rC��rC�rsrErr�s @r�test_try_except_no_exceptionz*TraceTestCase.test_try_except_no_exception����� �
���T�
� rc�2�d�}|j|gd��y)Nc�N� t�#YnxYw n#wxYw y#YyxYw#wxYwrrur"rrr�z6TraceTestCase.test_try_exception_in_else.<locals>.func�sE��
����#�O�� ���A�
��B��B���
�����s(��������"�"�$)r@rBrIrKrVr.)r/r{rorp��rCrrrtrr�s r�test_try_exception_in_elsez(TraceTestCase.test_try_exception_in_else�s�� �
���T�
� rc�2�d�}|j|gd��y)Nc�V�td�D]}td�D]}||z}� �dk(S)NrJr>r_)r��jras rr�z-TraceTestCase.test_nested_loops.<locals>.funcs2���1�X���q��A��A��A�"����6�Mr)r@rBrIrKrIrKrIrBrIrKrIrKrIrBrTrkrr�s r�test_nested_loopszTraceTestCase.test_nested_loopss�� �
���T�
� rc�2�d�}|j|gd��y)Nc�F�ddg}|r|j�}|r |S|r�d}|S)Nr>r�cr5)�seqrZs rr�z)TraceTestCase.test_if_break.<locals>.funcs7���a�&�C���G�G�I�����H�
�
���Hr)r@rBrIrKrTrIrKrTrMr.�r/rErr�s r�
test_if_breakzTraceTestCase.test_if_breaks�� �
���T�
� rc�<�d�}|j|gd�ddgz�y)Nc��d\}}}} td�D]} d}|dkDr d}nd}d}�|dk(r
|dk(r|dk(sJ�y#d}wxYw#d}Y�xYw) N)r>r>r>r�rLrNrr�r/rzr>r_)ra�c�dr�s rr�z6TraceTestCase.test_break_through_finally.<locals>.func6sz��$�J�A�q�!�Q�
��q��A�����q�5�!�������"���6�a�2�g�!�q�&�0�0�&�����
���s(�A�<�A�<�A�A�A�A )r@rBrIrKrTrMrcr.rorKrTrMrcrVro��
rC�r�rErr�s r�test_break_through_finallyz(TraceTestCase.test_break_through_finally4s/��
1�
���T�
��^�,�
Q� Rrc�<�d�}|j|gd�ddgz�y)Nc��d\}}}}} td�D]} d}|dkDr d}�d}d}� ||||fdk(sJ�y#d}wxYw#d}Y�xYw) N)r>r>r>r>r�rJrNrr�r/rz)rNr/r�r>r_)rar�r�r�r�s rr�z9TraceTestCase.test_continue_through_finally.<locals>.funcYsw��*�M�A�q�!�Q��
��q��A�����q�5�$�������"��q�!�Q�<�=�0�0�0�����
���s!�>�7�>�7�>�;�>�A)r@rBrIrKrTrMrcr.rorKrTrMrcrVrorKr�r�rr�s r�test_continue_through_finallyz+TraceTestCase.test_continue_through_finallyWs/��
1�
���T�
� �^�,�!
P� Qrc�2�d�}|j|gd��y)Nc�� y#wxYwrr"r"rrr�z7TraceTestCase.test_return_through_finally.<locals>.func}s��
�����s�rjrr�s r�test_return_through_finallyz)TraceTestCase.test_return_through_finally{s�� �
���T�
� rc�2�d�}|j|gd��y)Nc�<� ddzy#t$rYywxYw#YyxYw)NrJrrd)r�r"rrr�z;TraceTestCase.test_try_except_with_wrong_type.<locals>.func�s0��
��!�����
���
���s�� ����)r@rBrIr|rKrcr�rr�s r�test_try_except_with_wrong_typez-TraceTestCase.test_try_except_with_wrong_type�s�� �
���T�
� rc�<��d��fd�}|j|gd��y)NTc�<�� t�#�rd}wwxYw#d}Y|SxYw�Nr>rLru)�result� conditions �rr�z9TraceTestCase.test_finally_with_conditional.<locals>.func�s1���
�#�#�O�� �!"��!��
����M�s�
���)r@rBrIrKr-rMrcr.r0ro�r�rEr)rr�r�s @r�test_finally_with_conditionalz+TraceTestCase.test_finally_with_conditional�s&���� �
�
���T�
� rc�2�d�}|j|gd��y)Nc�:�d}dg}|r|j�|r �yr=r5��TRUEr,s rr�z3TraceTestCase.test_break_to_continue1.<locals>.func�s(���D���A��������� r)
r@rBrIrKrTrMrcrVrKr\rr�s r�test_break_to_continue1z%TraceTestCase.test_break_to_continue1�s�� �
���T�
�
rc�2�d�}|j|gd��y)Nc�B�d}dg}|r|j�|rn�|r�yyr=r5r�s rr�z3TraceTestCase.test_break_to_continue2.<locals>.func�s(���D���A���������r) r@rBrIrKrTrMrcrKr\rr�s r�test_break_to_continue2z%TraceTestCase.test_break_to_continue2�s�� �
���T�
� rc�2�d�}|j|gd��y)Nc��d}|r|r yyyr=r")r�s rr�z/TraceTestCase.test_break_to_break.<locals>.func�s���D�����r)r@rBrIrKrTrMrOrr�s r�test_break_to_breakz!TraceTestCase.test_break_to_break�s�� �
���T�
� rc�2�d�}|j|gd��y)Nc�0�dx}}|dk(r|dk(rd}yd}yd}y)Nr>rUrdr/r")rar�r,rh�zs rr�z+TraceTestCase.test_nested_ifs.<locals>.func�s(���I�A���A�v���6��A��A��rr�rr�s r�test_nested_ifszTraceTestCase.test_nested_ifs�s�� �
���T�
� rc�L�������fd�}dx��d�|j|gd��y)Nc�B���r�r �r tryyyytrtryyy)NFT)�D�E�F)�A�B�Cs���rr�z4TraceTestCase.test_nested_ifs_with_and.<locals>.funcs0�������#(� ���
�q���rTFr[r)rr�r�r�r�s @@@r�test_nested_ifs_with_andz&TraceTestCase.test_nested_ifs_with_ands-��� ����A������T�
� rc�2�d�}|j|gd��y)Nc�X�d} ddzd}y#t$r|dk(r
t��Yd}ywxYw)N�hellorLr�raiserW)�ZeroDivisionError�
ValueError)r,r!s rr�z.TraceTestCase.test_nested_try_if.<locals>.func'sD���A�
'��!���A��%�
'���<�$�,�&� ��A�
'�s��)�)� r@rBrIrKr-rTrMrVrXrr�s r�test_nested_try_ifz TraceTestCase.test_nested_try_if%��� �
���T�
� rc�L��Gd�d���fd�}|j|gd��y)Nc��eZdZd�Zd�Zy)�.TraceTestCase.test_if_false_in_with.<locals>.Cc��|Srr"rs rrz8TraceTestCase.test_if_false_in_with.<locals>.C.__enter__>rArc��yrr"r�s rrz7TraceTestCase.test_if_false_in_with.<locals>.C.__exit__@���rN�rrr rrr"rrr�r�=���
�
rr�c�@����5 ddd�y#1swYyxYwrr"�r�s�rr�z1TraceTestCase.test_if_false_in_with.<locals>.funcCs���������s��)r@rB�r�rAr�r�rIrBrorqrsrDr)rr�r�s @r�test_if_false_in_withz#TraceTestCase.test_if_false_in_with;s)��� � � �
���T�
� rc�2�d�}|j|gd��y)Nc�0� y#t$r tYywxYwr)rv�Xr"rrr�z7TraceTestCase.test_if_false_in_try_except.<locals>.funcWs��
����
��
�s��rcrr�s r�test_if_false_in_try_exceptz)TraceTestCase.test_if_false_in_try_exceptUs�� �
���T�
� rc�2�d�}|j|gd��y)Nc��Gd�d�}y)Nc� �eZdZddkrdZydZy)�DTraceTestCase.test_implicit_return_in_class.<locals>.func.<locals>.ArLr1r>rJN)rrr rar"rrr�r�gs���q�5��A��Arr�r")r�s rr�z9TraceTestCase.test_implicit_return_in_class.<locals>.funcfs��
�
r�r@rB�r>rArBrIrKr\rDrr�s r�test_implicit_return_in_classz+TraceTestCase.test_implicit_return_in_classds�� �
���T�
� rc�2�d�}|j|gd��y)Nc�R� y#t$r
}Yd}~yd}~wwxYw#t$rYywxYwrru��exs rr�z+TraceTestCase.test_try_in_try.<locals>.funcxs3��
���� �������
��
�s� ���� &�&r[rr�s r�test_try_in_tryzTraceTestCase.test_try_in_tryws�� �
���T�
� rc�`�d�}|j|gd��d�}|j|gd��y)Nc�\� t�#t$r
}Yd}~yd}~wwxYw#t$rYywxYwr)� TypeErrorr�r�s rr�z:TraceTestCase.test_try_in_try_with_exception.<locals>.func�s5��
��#�O��!�������
��
��� � ���� +�+� r@rBrIrKr-rTrcrVrXc�\� t�#t$r
}Yd}~yd}~wwxYw#t$rYywxYwr�r�r�r�s rr�z:TraceTestCase.test_try_in_try_with_exception.<locals>.func�s6��
��$�$��!�������
��
�r�)r@rBrIrKr-rTrMrOrr�s r�test_try_in_try_with_exceptionz,TraceTestCase.test_try_in_try_with_exception�s:�� �
���T�
� � �
���T�
� rc�4�dd�}|j|gd��y)Nc��|r|r|ryyyyrr")ra�pr�s rr�z/TraceTestCase.test_if_in_if_in_if.<locals>.func�s������� �rrc)rr>r>rr�s r�test_if_in_if_in_ifz!TraceTestCase.test_if_in_if_in_if�s�� �
���T�
� rc�~��Gd�d���fd�}�fd�}|j|gd��|j|gd��y)Nc��eZdZd�Zd�Zy)�-TraceTestCase.test_early_exit_with.<locals>.Cc��|Srr"rs rrz7TraceTestCase.test_early_exit_with.<locals>.C.__enter__�rArc��yrr"r�s rrz6TraceTestCase.test_early_exit_with.<locals>.C.__exit__�r�rNr�r"rrr�r��r�rr�c�P��dD]}��5 ddd�yy#1swY�!xYw)N�r>rJr")r�r�s �r�
func_breakz6TraceTestCase.test_early_exit_with.<locals>.func_break�s,������S���S���
��S�s��% c�@����5 ddd�y#1swYyxYwrr"r�s�r�func_returnz7TraceTestCase.test_early_exit_with.<locals>.func_return�s���������s��)
r@rBrIr�r�r�rKrIrorqrsrTrk)r@rB)rPrA)���rC)r�rErIrBrQrRrTrDr)rr�r�r�s @r�test_early_exit_withz"TraceTestCase.test_early_exit_with�sE��� � � � �
���Z�
�
�
���[�
� rc�>��d���fd�}|j|gd��y)Nc�@�|r d|dz
z|S|S#t$rY|SwxYwr=�r�rGs r�fooz;TraceTestCase.test_flow_converges_on_same_line.<locals>.foo�s9�����q�1�u�I��H�1�H��)����H��s�� �c�6��td�D]
}�|��yrr_)r�r�s �rr�z<TraceTestCase.test_flow_converges_on_same_line.<locals>.func�s����1�X���A��r)r@rBrI�rSrA�i����rCrqrsrBrIr�r�)r�rCr�)r�r{r�rVrqrsrBrDr)rr�r�s @r� test_flow_converges_on_same_linez.TraceTestCase.test_flow_converges_on_same_line�s$��� � �
���T�
� rc�2�d�}|j|gd��y)Nc�F�d} d|zy#t$r
}|r�Yd}~yd}~wwxYw)Nrr>�doner�)r,�errors rr�zCTraceTestCase.test_no_tracing_of_named_except_cleanup.<locals>.funcs8���A�
��!����%�
������
�s�
� �� r�rr�s r�'test_no_tracing_of_named_except_cleanupz5TraceTestCase.test_no_tracing_of_named_except_cleanups�� �
���T� � rc�L��Gd�d���fd�}|j|gd��y)Nc��eZdZd�Zd�Zy)�DTraceTestCase.test_tracing_exception_raised_in_with.<locals>.NullCtxc��|Srr"rs rrzNTraceTestCase.test_tracing_exception_raised_in_with.<locals>.NullCtx.__enter__-rArc��yrr")r�excinfos rrzMTraceTestCase.test_tracing_exception_raised_in_with.<locals>.NullCtx.__exit__/r�rNr�r"rr�NullCtxr,r�rrc�h�� ��5ddzddd�y#1swYyxYw#t$rYywxYw�Nr>rr�)rs�rr�zATraceTestCase.test_tracing_exception_raised_in_with.<locals>.func2s/���
��Y��a�C��Y�Y��$�
��
�s �%��%�"�%�%� 1�1)r@rBrIr�r�r�rKr-rIrorqrsrTrMrOr)rr�rs @r�%test_tracing_exception_raised_in_withz3TraceTestCase.test_tracing_exception_raised_in_with*s)��� � � �
���T�
� rc�8���fd��|j�gd��y)Nc�x�� �jdk(r y#gxt%x�n�nn��x�YycYwxYw#wxYwrk)rvrrms�rr�z=TraceTestCase.test_try_except_star_no_exception.<locals>.funcLsL���
������=�=�F�*����
�I�
����
�����s�7�4�7�7�9rnrr�s @r�!test_try_except_star_no_exceptionz/TraceTestCase.test_try_except_star_no_exceptionJrvrc�2�d�}|j|gd��y)Nc�^� y#gxt%x�}d}~nd}~�nn��x�YycYwxYw#wxYwrru�r�s rr�zCTraceTestCase.test_try_except_star_named_no_exception.<locals>.funcis4��
�����
�I�
����
��
���s�*�'�*�*�,)r@rBrIrcr.r�rr�s r�'test_try_except_star_named_no_exceptionz5TraceTestCase.test_try_except_star_named_no_exceptiongs�� �
���T�
� rc�2�d�}|j|gd��y)Nc�b� td��#gxt%x�n�nn��x�YycYwxYw#wxYwr�r�r"rrr�zATraceTestCase.test_try_except_star_exception_caught.<locals>.func}s3��
� ��m�#��
�J�
����
��
���s�
�)�,�,�.�r@rBrIr|rKrTr.r�rr�s r�%test_try_except_star_exception_caughtz3TraceTestCase.test_try_except_star_exception_caught{��� �
���T�
� rc�2�d�}|j|gd��y)Nc�n� td��#gxt%x�}d}~nd}~�nn��x�YycYwxYw#wxYwrrrs rr�zGTraceTestCase.test_try_except_star_named_exception_caught.<locals>.func�s3��
� ��m�#��
�J�
����
��
���s�
�/�2�2�4rrr�s r�+test_try_except_star_named_exception_caughtz9TraceTestCase.test_try_except_star_named_exception_caught�rrc�2�d�}|j|gd��y)Nc�x� td��#gxt%x�n�nn��x�YycYwxYw#t$rYywxYw�NrLr�r"rrr�zETraceTestCase.test_try_except_star_exception_not_caught.<locals>.func�sA��
��$�Q�-�'��� ����A�����
��
�s��*�-�-� 9�9r�rr�s r�)test_try_except_star_exception_not_caughtz7TraceTestCase.test_try_except_star_exception_not_caught�r�rc�2�d�}|j|gd��y)Nc�� td��#gxt%x�}d}~nd}~�nn��x�YycYwxYw#t$rYywxYwrr�rs rr�zKTraceTestCase.test_try_except_star_named_exception_not_caught.<locals>.func�sA��
��$�Q�-�'��� ����A�����
��
�s��0�3�3� ?�?r�rr�s r�/test_try_except_star_named_exception_not_caughtz=TraceTestCase.test_try_except_star_named_exception_not_caught�r�rc�2�d�}|j|gd��y)Nc�� tdtd�td�g��#gxt%x�}d}~nd}~�nnt%x�n�nnt%x���n��x�YycYwxYw#gxt%x�F td��#gxt%x�n�nnt%x�}d}~nd}~�nn��x�YncYwxYwn�nn��x�YycYwxYw)N�egrNzbad typersr)�ExceptionGroupr�r��OSErrorrs rr�z7TraceTestCase.test_try_except_star_nested.<locals>.func�s���
� �(��#�A�� �*�(=�>�@�@��� ����A������A��"��������
�J�
��#�B�-�'�������B��!����B�����
���s?� #�0A"�A � A"�A%�A%�%C�2A=�=,B.�)B2 �1C)r@rBrIrKrTrMrKr-rcrVr.rorpryr�rr)rsr{)�rC)�rC)�rC)�rC)r)rErr�s r�test_try_except_star_nestedz)TraceTestCase.test_try_except_star_nested�s�� �*
���T�
� rc�2�d�}|j|gd��y)Nc�� d�y)Nc��yrr"rGs r�<lambda>zATraceTestCase.test_notrace_lambda.<locals>.func.<locals>.<lambda>s��arr"r"rrr�z/TraceTestCase.test_notrace_lambda.<locals>.funcs��
��
rr[rr�s r�test_notrace_lambdaz!TraceTestCase.test_notrace_lambdas�� �
���T�
� rc�2�d�}|j|gd��y)Nc��Gd�d�}y)Nc��eZdZdZd�Zy)�PTraceTestCase.test_class_creation_with_docstrings.<locals>.func.<locals>.Class_1z the docstring. 2c��d|_y)z Another docstring. 4rNN)rars rrzYTraceTestCase.test_class_creation_with_docstrings.<locals>.func.<locals>.Class_1.__init__s ���D�FrN)rrr r!rr"rr�Class_1r3s
��'�rr5r")r5s rr�z?TraceTestCase.test_class_creation_with_docstrings.<locals>.funcs��
�
rr�rr�s r�#test_class_creation_with_docstringsz1TraceTestCase.test_class_creation_with_docstringss�� �
���T�
� rc�2�d�}|j|gd��y)Nc�^�d�}|d�|tdg��Gd�d���}y)Nc��d�}|S)Nc��|Srr")r�s r�_decz_TraceTestCase.test_class_creation_with_decorator.<locals>.func.<locals>.decorator.<locals>._dec's���Hrr")r�r;s r� decoratorzQTraceTestCase.test_class_creation_with_decorator.<locals>.func.<locals>.decorator&s����rrdr/c��eZdZy)�PTraceTestCase.test_class_creation_with_decorator.<locals>.func.<locals>.MyObjectN)rrr r"rr�MyObjectr>+s��
rr?)�len)r<r?s rr�z>TraceTestCase.test_class_creation_with_decorator.<locals>.func%s:��
�
�q�\�
��Q�C���
�
���
r)r@rBrcr�rIrTrkrVr.rVr�rIrTrkro)rdrArcrp)rqrErV�rJrArKr\rcrArKr\ror�rr�s r�"test_class_creation_with_decoratorz0TraceTestCase.test_class_creation_with_decorator$s�� �
���T�$
� rc�n� �tjd�}d�� � fd�}gd�}g}|j|�|�tjd�|j
j}|D���cgc]\}}}||z
t|f��}}}}|j||�|j||�ycc}}}w)N� _testcapic3�K�d��y�wr=r"r"rr�genzFTraceTestCase.test_no_line_event_after_creating_generator.<locals>.genYs�����G�s�c�����D]}�yrr")�_rFs �rr�zGTraceTestCase.test_no_line_event_after_creating_generator.<locals>.func\s�������r)r@rIrorqrsrBrTrI)rrrArsre)
r�
import_module�settrace_to_recordr~rr�r��EVENT_NAMES�assertEqualr�)
rrDr��EXPECTED_EVENTSr��
start_line�whatrCr�rFs
@r�+test_no_line_event_after_creating_generatorz9TraceTestCase.test_no_line_event_after_creating_generatorRs����
"�/�/��<� � � �
�� ���$�$�V�,�d�f�c�l�l�4�6H��]�]�1�1�
�&,�
�%+�!��t�S��*�_�k�$�/�0�%+� �
�
�����1����T�?�3��
s�.B0c���d��fd�} |tj�_tj|�t g�|jd�tjd�y#t$r~}d}|j}|r7|jjjdk(r|dz
}|j}|r�7|dk(r|jd�n|dkDr|jd�Yd}~��d}~wwxYw#tjd�wxYw) NFc�$���sd�t�tSr�)rvr�)r�r�r��raiseds �r�
error_oncez5TraceTestCase.test_settrace_error.<locals>.error_once�s���������Lr�No exception raisedr�test_settrace_errorr>�Traceback is missing frame�"Traceback has frame more than once)r~r�r�rr@r�rv�
__traceback__�tb_frame�f_code�co_name�tb_next)rrTr��count�tbrSs @rrVz!TraceTestCase.test_settrace_error~s������ � �&0�C�M�M�O�#��L�L��$���G�
�I�I�+�,��L�L�����
@��E��!�!�B���;�;�%�%�-�-�1F�F��Q�J�E��Z�Z�����z�� � �6�7����� � �>�?���
@��
�L�L���s6�9A*�C4�* C1�3AC,�:-C,�'C4�,C1�1C4�4Dc��tjd�} |jg�tg�|j d�tjd�y#t
$r~}d}|j}|r7|jjjdk(r|dz
}|j}|r�7|dk(r|j d�n|dkDr|j d�Yd}~��d}~wwxYw#tjd�wxYw)NrDrUr�test_testcapi_settrace_errorr>rWrX)
rrI�settrace_to_errorr@r�rvrYrZr[r\r]r~r)rrDr�r^r_s rraz*TraceTestCase.test_testcapi_settrace_error�s���"�/�/��<� � ��'�'��+���G�
�I�I�+�,��L�L�����
@��E��!�!�B���;�;�%�%�-�-�1O�O��Q�J�E��Z�Z�����z�� � �6�7����� � �>�?���
@��
�L�L���s5�A�C$� C!�#AC�*-C�C$�C!�!C$�$C;c�d�i}tdddz�d�|�|d}gd�}|j||�y)Nz�def f(): # line 0
x = 0 # line 1
y = 1 # line 2
r�izn # lines 3 through (1 << 16)
x += 1 #
returnr!)r@rBrI)irC)�rC)rdrEr#)rr�r!rMs r�test_very_large_functionz&TraceTestCase.test_very_large_function�sG�����
��)�,�
./� 0�
�c�F��
��
���Q��0rN)Orrr r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�rrrrr rr
rrrrrr&r*r2r7rWr`rdrhrur{rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r rrrrrr r*r/r6rBr�cpython_onlyrPrVrarer"rrr�r�Ys���6�
�����D�3�0�8�&���&�&�&�&�%�#��"�,�+�'�)�+�E�
��>���0�*J3�X23�h ��"�:�@�4�2!R�F"Q�H
��&�:�.�.�$�(�.�,�4
��&�"'�R�",�\"�H�,�@�:�(�,�,�,�,-�^
��&,�\
���)4��)4�V�<
������01rr�)rAr{rCrEc�2��eZdZdZ�fd�Zed��Z�xZS)�SkipLineEventsTraceTestCasez8Repeat the trace tests, but with per-line events skippedc�b��|D�cgc]
}|ddk7s�|��}}t�|�|||�ycc}w)Nr>rC)�superr�)rr�r�r�r��skip_line_events� __class__s �rr�z*SkipLineEventsTraceTestCase.compare_events�s:���'6�I��!�!�A�$�&�.�A���I�
���{�F�4D�E��Js�
,�,c��td��S)NF)r�r�r"rrr�z'SkipLineEventsTraceTestCase.make_tracer�s
����.�.r�rrr r!r�rfr��
__classcell__�rms@rriri�s ���B�F��/��/rric�2��eZdZdZ�fd�Zed��Z�xZS)�TraceOpcodesTestCasez;Repeat the trace tests, but with per-opcodes events enabledc����|D�cgc]
}|ddk7s�|��}}t|�dkDr&|jt|�t|�d��t�|�
|||�ycc}w)Nr>�opcodez)No 'opcode' events received by the tracer)�msg)r@�
assertLessrkr�)rr�r�r�r��skip_opcode_eventsrms �rr�z#TraceOpcodesTestCase.compare_events�si���)/�D��A�1�Q�4�8�3C�a���D��v�;��?��O�O�C� 2�3�S��[� K�
�
M�
���{�,>��P�� Es
�
A �A c��td��S)NT)r�r�r"rrr�z TraceOpcodesTestCase.make_tracer�s
���$�/�/rrorqs@rrsrs�s ���E�Q��0��0rrsc�N�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d �Zd
�Zd�Z
y)
�RaisingTraceFuncTestCasec�h�|jtjtj��yr�r�r~rr�rs rr�zRaisingTraceFuncTestCase.setUp�s��������c�l�l�n�5rc�D�||jk(rt�|jS)zXA trace function that raises an exception in response to a
specific trace event.)�raiseOnEventr�r�r�s rr�zRaisingTraceFuncTestCase.trace�s"���D�%�%�%����:�:�rc�2�|jdk(rd}d|z}yy)zThe function to trace; raises an exception if that's the case
we're testing, so that the 'exception' trace event fires.r{rr>N)r)rr,rhs rr!zRaisingTraceFuncTestCase.f�s#������+��A��!��A�rc�>�||_ ttj�dz�D]C}tj|j
� |j
�|jd��Ey#t$rY�RwxYw#t$r|jd�YywxYw)zTTests that an exception raised in response to the given event is
handled OK.r>zexception not raised!zrecursion counter not resetN)
rr`r~�getrecursionlimitrr�r!r�r�r�)rr�r�s r�run_test_for_eventz+RaisingTraceFuncTestCase.run_test_for_events���"���
5��3�0�0�2�Q�6�7�����T�Z�Z�(�7��F�F�H��I�I�5�6�8��"������ 5��I�I�3�4� 5�s6�AA?�A0�A?�0 A<�9A?�;A<�<A?�?B�Bc�&�|jd�y)NrA�r�rs r� test_callz"RaisingTraceFuncTestCase.test_call�������'rc�&�|jd�y)NrCr�rs r� test_linez"RaisingTraceFuncTestCase.test_liner�rc�&�|jd�y)NrEr�rs r�test_returnz$RaisingTraceFuncTestCase.test_returns������)rc�&�|jd�y�Nr{r�rs r�test_exceptionz'RaisingTraceFuncTestCase.test_exceptions������,rc����d����fd��tj�� ��|jd�y#t$rddl}|j
�YywxYw)Nc�:�td�D]
}t|��y)NrN)r`�printrgs rr!z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.f s���1�X���a��rc�t��|dk(r1|j�jjdzk(rtd���S)NrCrJz
i am crashing)r�r�r�r�)r��why�extrar!�gs ��rr�z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.g$s5����v�
����!�*�*�";�";�a�"?�?�"�?�3�3��Hrzexception not propagatedr)r~rr�r�r��collect)rr�r!r�s @@r�test_trash_stackz)RaisingTraceFuncTestCase.test_trash_stacksR��� � � ���Q�� 2�
�C�
�I�I�0�1��� ���B�J�J�L� �s�;�A�Ac����d�}��fd��tj�} tj�� |�tj|�y#t$rY�!wxYw#tj|�wxYw)Nc� �d}|jy)Nr)�no_such_attrrGs rr!z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.f6s���A�
�N�Nrc�J��|dk(r|\}}}�j|t��Sr�)�assertIsInstancerv)r�r�r��typer{r�r�rs ��rr�z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g:s,�����$�),�&��i���%�%�i��;��Hr)r~r�r�AttributeError)rr!�existingr�s` @r�test_exception_argumentsz1RaisingTraceFuncTestCase.test_exception_arguments5se��� � ��<�<�>�� #��L�L��O�
���
�L�L��"�� "�
��
��
�L�L��"�s(�A#�A� A �A#�A � A#�#A:c�����td����fd��d�}|jt�5}tj��|�ddd�|j j
��y#1swY�&xYw)NzBOOM!c�$��|dk(r��d|_�S)NrCT)r�)r�r�r�r{r�s ��rr�zRRaisingTraceFuncTestCase.test_line_event_raises_before_opcode_event.<locals>.traceMs��������$(�E�!��Lrc��yrr"r"rrr!zNRaisingTraceFuncTestCase.test_line_event_raises_before_opcode_event.<locals>.fRr�r)r��assertRaisesr~r�assertIsr{)rr!�caughtr{r�s @@r�*test_line_event_raises_before_opcode_eventzCRaisingTraceFuncTestCase.test_line_event_raises_before_opcode_eventKs\����w�'� � �
�
�
�
�z�
*�f��L�L���
�C�+�
�
�
�f�&�&� �2�+�
*�s�A.�.A7N)rrr r�r�r!r�r�r�r�r�r�r�r�r"rrr{r{�s9��6���5�"(�(�*�-�2�,#�,3rr{c�"�eZdZdZ dd�Zd�Zy)�
JumpTracerz>Defines a trace function that jumps from one place to another.c��|j|_||_||_||_|rdn|jj
|_d|_y)NF)r��code�jumpFrom�jumpTor�r�� firstLiner�)r�functionr�r�r�� decorateds rrzJumpTracer.__init__as@���%�%�� � ��
������
�!*��� � �0H�0H����� rc�L�|jry|j�2|j|jk(r|dk(r|jdz
|_||j
k(r�|j��|j|j|jzk(rm|}|�A|j|jk7r(|j}|�|j|jk7r�(|�& |j|jz|_d|_|jS#t$r|j|_Y�/wxYw)NrCr>T)r�r�r[r�r�r�r�r�r�r�r�)rr�r�r�r!s rr�zJumpTracer.tracejs����9�9��
�N�N�"�u�|�|�t�y�y�'@����"�^�^�a�/�D�N��T�Z�Z��D�N�N�$>����$�.�.�4�=�=�"@�@��A��-�A�H�H�� � �$9��H�H���-�A�H�H�� � �$9��}�1�%)�^�^�d�k�k�%A�E�N�!�� ��z�z���!�1�%)�[�[�E�N�1�s�D�D#�"D#N)rCF)rrr r!rr�r"rrr�r�^s��H�9?� ��rr�c�� |jd�y#t$r&}|jdt|�v�Yd}~yd}~wwxYw)NrJ�integer)rr�r��r
r�s r�no_jump_to_non_integersr��s;��+��
�
�a����+��
�
�i�3�q�6�)�*�*��+�s�� A�>�Ac�� tj�j}|j|_t d��#t
$r}dt
|�vr�Yd}~yd}~wwxYw)Nz'Trace-function-less jump failed to failr�)r~r�r�r��AssertionErrorr�r�)�previous_framer�s r�no_jump_without_trace_functionr��s]��
H�����/�/��"0�"9�"9����F�G�G�����#�a�&� ��!���s�/<� A�A�Ac��eZdZdZd�Zd�Z d�d�Z d�d�Zd�d�Zd�d�Z ed d
d
g�d��Z
edd gd
��d��Zed ddgeef��d��Z
eddgd��d��Zedddg�d��Zeddgd��d��Zed
dddgeef��d��Zedd gd��d��Ze ddd
dg�ed���Ze ddgd��ed���Zed dd
g�d��Zeddgd ��d!��Zedd"dd"g�d#��Zedd$dd$ged%f�d&��Zedd'dd'ged%f�d(��Zedd'ddged)f�d*��Zed
dd ged+f�d,��Zeddddg�d-��Zedd
gd.��d/��Z edd
d d
g�d0��Z!e dd
d d
g�d1��Z"ed
d gd2��d3��Z#e d
d gd2��d4��Z$edddg�d5��Z%ed
d gd6��d7��Z&edddg�d8��Z'ed
d gd9��d:��Z(edd$gd;��d<��Z)edd$gd;��d=��Z*eddgd>��d?��Z+edd gd@�eef��dA��Z,eddgdB��dC��Z-e ddgdB��dD��Z.eddgdE��dF��Z/e ddgdE��dG��Z0eddgdH��dI��Z1e ddgdH��dJ��Z2eddgdK��dL��Z3e ddgdK��dM��Z4edNd'gdO��dP��Z5ed
dgdQ�eef��dR��Z6e d
dgdQ�eef��dS��Z7ed
dgdT��dU��Z8eddNgdV��dW��Z9ed d$d$dNgeef��dX��Z:e d d$d$dNgeef��dY��Z;edd
d ged+f�dZ��Z<edd[d ged\f�d]��Z=edd
dged^f�d_��Z>edd
dged^f�d`��Z?edd
dged^f�da��Z@edd
dged^f�db��ZAed d
gedcf�dd��ZBe d d
gedcf�de��ZCed
dddgedcf�df��ZDe d
dddgedgf�dh��ZEed d
gedif�dj��ZFe d d
gedif�dk��ZGed
dgdl�edif�dm��ZHe d
dgdl�edif�dn��ZIed d
d
dg�do��ZJeddgdp��dq��ZKed d
d
g�dr��ZLeddgds��dt��ZMedd$gd;�eef��du��ZNed ddg�dv��ZOed
dgdw��dx��ZPedd gdy��dz��ZQed dged{f�d|��ZRed dged{f�d}��ZSed
dgd~�ed{f�d��ZTed
ddged{f�d���ZUed$d gd���d���ZVed$d gd���d���ZWed
dgd���d���ZXe d
dgd���d���ZYedd$ddged+f�d���ZZed$dd dgedcf�d���Z[e d$dd dgedcf�d���Z\d��Z]d��Z^d��Z_d��Z`edd
d gd�ed�f���d���Zaedd d gd�ed�f���d���Zbedd d gd�ed�f���d���Zced
dddgd����d���Zdedd
d d
geef��d���Zeed
d geef��d���ZfedNdgd��eef��d���Zge dd
d d
geef��d���Zhe d
d geef��d���Zie dNdgd��eef��d���Zjed
d$gedif���d���ZkeddNgedif���d���Zled
d$gedif���d���Zmedd
d d
geef��d���Zned
dgd��eef��d���Zoepj�d��d���Zredd
d d
geef��d���Zsy)��JumpTestCasez&assigning None to [0-9]+ unbound localc��|jtjtj��tjd�yrr}rs rr�zJumpTestCase.setUp��&��������c�l�l�n�5����T�rc�n�||k7r0|jdt|�zdzdzt|�z�yy)NzOutputs don't match:
Expected: r�z
Received: )r��repr)r�expected�receiveds r�compare_jump_outputz JumpTestCase.compare_jump_output�sH���x���I�I�$�&*�8�n�5�7;�<�#�$�&*�8�n�5�
6� rNc �T�|} t| d�r| j} t| d�r�t| ||||�}
tj|
j
�g}t
j�5}|�|j|j|��|�|j|j|��n8|jtj��tjd�||�ddd�tjd�|j||�y#1swY�1xYw)N�__wrapped__r�)�hasattrr�r�r~rr��
contextlib� ExitStack�
enter_context�assertRaisesRegex�assertWarnsRegex�warnings�catch_warnings�simplefilterr��
rr�r�r�r�r�r�r��warning�wrappedr�r
�stacks
rr�zJumpTestCase.run_test�s������g�}�-��)�)�G��g�}�-��G�X�v�u�i�H�����V�\�\�"���
�
!�
!�
#�u�� ��#�#�$:�D�$:�$:�E�$B�C��"��#�#�$9�D�$9�$9�7�$C�D��#�#�H�$;�$;�$=�>��%�%�g�.���L�$� ���T��� � ��6�2�$�
#�s
�,BD�D'c �2�|} t| d�r| j} t| d�r�t| ||||�}
tj|
j
�g}t
j�5}|�|j|j|��|�|j|j|��tj||��ddd�tjd�tjd�|j||�y#1swY�FxYw)Nr�)r�r�r�r~rr�r�r�r�r�r��asynciorO�set_event_loop_policyr�r�s
r�run_async_testzJumpTestCase.run_async_test�s������g�}�-��)�)�G��g�}�-��G�X�v�u�i�H�����V�\�\�"���
�
!�
!�
#�u�� ��#�#�$:�D�$:�$:�E�$B�C��"��#�#�$9�D�$9�$9�7�$C�D��K�K��V��%�$� ���T���%�%�d�+�� � ��6�2�$�
#�s
�,AD
�
Dc�&�������������fd�}|S)zqDecorator that creates a test that makes a jump
from one place to another in the following code.
c�<���t���������fd��}|S)Nc
�8��|j������d���y�NT)r�r�r�r�)r��rr�r�r�r�r�r�r�s �������rr9z7JumpTestCase.jump_test.<locals>.decorator.<locals>.test�s'����
�
�d�H�f�h�$)��$�PW��Yrr�r�r9r�r�r�r�r�r�s` ������rr<z)JumpTestCase.jump_test.<locals>.decorator��(���
�4�[�
Y�
Y��
Y��Krr"�r�r�r�r�r�r�r<s`````` r� jump_testzJumpTestCase.jump_test����� � ��rc�&�������������fd�}|S)z~Decorator that creates a test that makes a jump
from one place to another in the following asynchronous code.
c�<���t���������fd��}|S)Nc
�8��|j������d���yr�)r�r�s �������rr9z=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.test�s)����#�#�D�(�F�H�$)��$�PW�$�Yrrr�s` ������rr<z/JumpTestCase.async_jump_test.<locals>.decorator�r�rr"r�s`````` r�async_jump_testzJumpTestCase.async_jump_test�r�rr>rLc�j�|jd�|jd�|jd�y�Nr>rJrL�r�r
s r�test_jump_simple_forwardsz&JumpTestCase.test_jump_simple_forwards��&���
�
�a���
�
�a���
�
�a�rrJ)r>r>rJc�H�|jd�|jd�yr^r�r�s r�test_jump_simple_backwardsz'JumpTestCase.test_jump_simple_backwards�����
�
�a���
�
�a�rrUrN�r�c�R�d}|�|jd�y|jd�y�NrLrNr��r
r,s r�test_jump_is_none_forwardsz'JumpTestCase.test_jump_is_none_forwards�s$�����9��M�M�!���M�M�!�rrd)rLrNrdc�t�d}|�|jd�n|jd�|jd�y�NrLrNrdr�r�s r�test_jump_is_none_backwardsz(JumpTestCase.test_jump_is_none_backwardss0�����9��M�M�!���M�M�!���
�
�a�rc�R�d}|�|jd�y|jd�yr�r�r�s r�test_jump_is_not_none_forwardsz+JumpTestCase.test_jump_is_not_none_forwards s$�����=��M�M�!���M�M�!�r)rNrNrdc�t�d}|�|jd�n|jd�|jd�yr�r�r�s r�test_jump_is_not_none_backwardsz,JumpTestCase.test_jump_is_not_none_backwardss0�����=��M�M�!���M�M�!���
�
�a�rc��dD]+}|jd�dD]}|jd���-|jd�y)Nr�rJ�rLrUrNr��r
r�r~s r�test_jump_out_of_block_forwardsz,JumpTestCase.test_jump_out_of_block_forwardss<���A��M�M�!�����
�
�a� ��� �
�
�a�r)r>rLrNr>rLrNrdrWc���|jd�dD]<}|jd�dD]}|jd��|jd��>|jd�y)Nr>r�rL)rJrNrdrWr�r�s r� test_jump_out_of_block_backwardsz-JumpTestCase.test_jump_out_of_block_backwards"sT���
�
�a���A��M�M�!�����
�
�a� ���M�M�!�� �
�
�
�a�rc��K�dD]7}|ddg�23d{���}|jd�|jd��,y7�)6|jd��P�w)Nr�r>rJrLrUrNr��r
r-r�s r�)test_jump_out_of_async_for_block_forwardsz6JumpTestCase.test_jump_out_of_async_for_block_forwards,sT�����A�$�a��V�,�
!�a��
�
�a� ��
�
�a� ��
!��,�
�M�M�!��s%�A�A�A�A�&A�A�A)rJrUrJrUrNrdc���K�dD]G}|jd�|dg�23d{���}|jd�|jd��,y7�)6|jd��`�w)Nr�rJr>rUrNrdr�rs r�*test_jump_out_of_async_for_block_backwardsz7JumpTestCase.test_jump_out_of_async_for_block_backwards5s\�����A��M�M�!��$�a�S�>�
!�a��
�
�a� ��
�
�a� � �
!��>�
�M�M�!��s%� A%�A�A�A�&A%�A�A%c�H�|jd�|jd�yr�r�r�s r�test_jump_to_codeless_linez'JumpTestCase.test_jump_to_codeless_line?s���
�
�a���
�
�a�r)r>rJrLc�j�|jd�|jd�|jd�yr�r�r�s r�test_jump_to_same_linez#JumpTestCase.test_jump_to_same_lineEr�rr1c�� |jd�|jd� |jd�|jd�|jd�y#|jd�wxYw#|jd� |jd�|jd�n#|jd�wxYw|jd�wxYw)NrJrUrdr/r1r�r�s r�test_jump_in_nested_finallyz(JumpTestCase.test_jump_in_nested_finallyLs��� ��M�M�!���M�M�!��
!��
�
�a� ��
�
�a� ��M�M�!����
�
�a� ��
�M�M�!��
!��
�
�a� ��
�
�a� ���
�
�a� ���M�M�!��s.�A/�A�A,�/C
�B%�C
�%B8�8C
rW�c��� |jd�ddz |jd�|jd�y#|jd�|jd�wxYw)NrJr>rrdrWr�r�s r�test_jump_in_nested_finally_2z*JumpTestCase.test_jump_in_nested_finally_2XsQ�� ��M�M�!��
�a�C���M�M�!���M�M�!���
�M�M�!���M�M�!��s �<�$A rqc�� |jd�ddz |jd� |jd�|jd�|jd�y#|jd�wxYw#|jd� |jd�|jd�n#|jd�wxYw|jd�wxYw)NrJr>rrdr/r�rqr�r�s r�test_jump_in_nested_finally_3z*JumpTestCase.test_jump_in_nested_finally_3cs���
��M�M�!��
�a�C���M�M�!��
"��
�
�a� ��
�
�b�!��M�M�"����
�
�b�!��
�M�M�!��
"��
�
�a� ��
�
�b�!���
�
�b�!���M�M�"��s.�A5�A�A2�5C�B+�C�+B>�>Cz"comes after the current code blockc�� |jd�|jd�|jd�y#|jd�|jd�YyxYw�NrJrUrNr�r�s r�5test_no_jump_over_return_try_finally_in_finally_blockzBJumpTestCase.test_no_jump_over_return_try_finally_in_finally_blockrsM��
��M�M�!���M�M�!���M�M�!����
�M�M�!���M�M�!���� �6�$A�afterc�J�|jd� |jd��r�r�r�s r� test_no_jump_infinite_while_loopz-JumpTestCase.test_no_jump_infinite_while_loop�s"���
�
�a����M�M�!��rc�n�d}|jd�|dkr|jd�|dz
}|dkr�yy)Nr>rJrUr��r
r�s r�#test_jump_forwards_into_while_blockz0JumpTestCase.test_jump_forwards_into_while_block�s8��
���
�
�a���1�f��M�M�!��
��F�A��1�fr)rLrLrLrNc�l�d}|dkr|jd�|dz
}|dkr�|jd�y)Nr>rJrLrNr�rs r�$test_jump_backwards_into_while_blockz1JumpTestCase.test_jump_backwards_into_while_block�s:��
���1�f��M�M�!��
��F�A��1�f� �
�
�a�rc��t|d�5|jd�ddd�|jd�y#1swY�xYwr��r rr�s r�$test_jump_forwards_out_of_with_blockz1JumpTestCase.test_jump_forwards_out_of_with_block��2��
�&�!�
$��M�M�!��%��
�
�a��%�
$�� �9�Ac���K�t|d�4�d{���|jd�ddd��d{���|jd�y7�77�#1�d{���7swY�(xYw�wr��r$rr�s r�*test_jump_forwards_out_of_async_with_blockz7JumpTestCase.test_jump_forwards_out_of_async_with_block��F����$�V�Q�/�/��M�M�!��0�/��
�
�a��0��/��/�/�/��A�A$�A�A$�A�A$�A
�A$�
A$�A!�A�A!�A$)r>rJr>rJrLrrc��|jd�t|d�5|jd�ddd�y#1swYyxYwr��rr r�s r�%test_jump_backwards_out_of_with_blockz2JumpTestCase.test_jump_backwards_out_of_with_block��0���
�
�a��
�&�!�
$��M�M�!��%�
$�
$�� �9�Ac���K�|jd�t|d�4�d{���|jd�ddd��d{���y7�&7�#1�d{���7swYyxYw�wr��rr$r�s r�+test_jump_backwards_out_of_async_with_blockz8JumpTestCase.test_jump_backwards_out_of_async_with_block��D�����
�
�a��$�V�Q�/�/��M�M�!��0�/�/��/��/�/�/��C�"A$�A�A$�A�A$�A
�A$�
A$�A!�A�A!�A$c�� |jd�|jd�|jd�y#|jd�wxYwrr�r�s r�+test_jump_forwards_out_of_try_finally_blockz8JumpTestCase.test_jump_forwards_out_of_try_finally_block��;�� ��M�M�!���M�M�!���
�
�a���
�M�M�!��� �6�A )r>r>rLrNc��|jd� |jd�|jd�y#|jd�wxYw�Nr>rLrNr�r�s r�,test_jump_backwards_out_of_try_finally_blockz9JumpTestCase.test_jump_backwards_out_of_try_finally_block��8���
�
�a�� ��M�M�!���M�M�!���F�M�M�!��� �6�A c�x� |jd�|jd�y#|jd��xYw�NrJrUrdr�r�s r�*test_jump_forwards_out_of_try_except_blockz7JumpTestCase.test_jump_forwards_out_of_try_except_block��7�� ��M�M�!�� �
�
�a��� ��M�M�!�����%�9)r>r>rLc�x�|jd� |jd�y#|jd��xYwr4r�r�s r�+test_jump_backwards_out_of_try_except_blockz8JumpTestCase.test_jump_backwards_out_of_try_except_block��5���
�
�a�� ��M�M�!��� ��M�M�!�����%�9)rUrWr/c��� ddz|jd�y#t$r%|jd�|jd�Y�?t$r|jd�Y�ZwxYw�Nr>rrUrNrWr/�r�r�FloatingPointErrorr�s r�test_jump_between_except_blocksz,JumpTestCase.test_jump_between_except_blocks�sY�� �
�a�C� �
�
�a���!� ��M�M�!���M�M�!��!� ��M�M�!�� �s��+A"�A"�!A"c��� ddz|jd�|jd�y#t$r%|jd�|jd�Y�PwxYw#|jd�wxYwrB)r�rr�s r� test_jump_from_except_to_finallyz-JumpTestCase.test_jump_from_except_to_finally�s`�� �
�a�C�
�M�M�!���
�
�a���!� ��M�M�!���M�M�!�� ��
�M�M�!��s!�*�+A�A�A�A�A.)rUrdrWc�� ddz|jd�y#|jd�|jd�|jd�Y�IxYw)Nr>rrUrNrdrWr�r�s r�test_jump_within_except_blockz*JumpTestCase.test_jump_within_except_block�sG�� �
�a�C�
�
�
�a��� ��M�M�!���M�M�!���M�M�!��s ��5A)r>rNr>rNc��|jd� ddzd}y#t$r}|jd�Yd}~d}yd}~wwxYw)Nr>rrNrJ�rr�)r
r�r,s r�test_jump_over_try_exceptz&JumpTestCase.test_jump_over_try_except�sG���
�
�a�� �
��E�
���!� ��M�M�!������ �s�� A�<�A)r>rUrNr�c���|jd�t|d�5|jd�ddd�t|d�5|jd�ddd�y#1swY�0xYw#1swYyxYw�Nr>rJrLrUrNr&r�s r�test_jump_across_withz"JumpTestCase.test_jump_across_with��W���
�
�a��
�&�!�
$��M�M�!��%�
�&�!�
$��M�M�!��%�
$�%�
$��
$�
$���A�A+�A(�+A4c��jK�|jd�t|d�4�d{���|jd�ddd��d{���t|d�4�d{���|jd�ddd��d{���y7�\7�=#1�d{���7swY�MxYw7�?7� #1�d{���7swYyxYw�wrNr+r�s r�test_jump_across_async_withz(JumpTestCase.test_jump_across_async_with �|�����
�
�a��$�V�Q�/�/��M�M�!��0�/�$�V�Q�/�/��M�M�!��0�/�/�0��/��/�/�/��/��/��/�/�/���"B3�B�B3�B�B3�B�B3�B�B3�B�0B3�;B�<B3�B3�B�B�B�B3�B3�B0�$B'�%B0�,B3)r>rLrNrdc���|jd�dD]9}t|d�5|jd�ddd�|jd��;|jd�y#1swY�.xYw�Nr>r�rLrUrNrdr&rs r�,test_jump_out_of_with_block_within_for_blockz9JumpTestCase.test_jump_out_of_with_block_within_for_block sV���
�
�a���A��f�a�(��
�
�a� �)��M�M�!��� �
�
�a��)�(�s�A"�"A+ c��K�|jd�dD]I}t|d�4�d{���|jd�ddd��d{���|jd��K|jd�y7�J7�+#1�d{���7swY�;xYw�wrWr+rs r�2test_jump_out_of_async_with_block_within_for_blockz?JumpTestCase.test_jump_out_of_async_with_block_within_for_block sj�����
�
�a���A�(���3�3��
�
�a� �4�3��M�M�!��� �
�
�a��4��3��3�3�3�sC�'B
�A4�B
�A8�B
�
A6�*B
�6B
�8B
�>B�?B
�B
)r>rJrLrNrrrdc��|jd�t|d�5t|d�5|jd�ddd�|jd�ddd�|jd�y#1swY�4xYw#1swY�'xYw�Nr>rJrLrUrNrdr&r�s r�-test_jump_out_of_with_block_within_with_blockz:JumpTestCase.test_jump_out_of_with_block_within_with_block sd���
�
�a��
�&�!�
$��f�a�(��
�
�a� �)��M�M�!��%� �
�
�a��)�(��%�
$�s!�
A<�A0�A<�0A9 �5A<�<Bc��RK�|jd�t|d�5t|d�4�d{���|jd�ddd��d{���|jd�ddd�|jd�y7�P7�1#1�d{���7swY�AxYw#1swY�4xYw�wr\)rr 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& sx�����
�
�a��
�&�!�
$�(���3�3��
�
�a� �4�3��M�M�!��%� �
�
�a��4��3��3�3�3��%�
$�sa�B'�B�B�B�B�B�B�B�(B'�B�B�B �B�
B �B�B$� B')rJrUrdrWc�b� |jd�t|d�5|jd�ddd�|jd�|jd�y#1swY�,xYw#t|d�5|jd�ddd�n#1swYnxYw|jd�wxYw�NrJrUrNrdrWr&r�s r�0test_jump_out_of_with_block_within_finally_blockz=JumpTestCase.test_jump_out_of_with_block_within_finally_block/ s}�� ��M�M�!���f�a�(��
�
�a� �)��M�M�!���
�
�a��)�(���f�a�(��
�
�a� �)�(�(���M�M�!��s.�A(�A�A%�(
B.�5B� B.�B�B.c ���K� |jd�t|d�4�d{���|jd�ddd��d{���|jd�|jd�y7�H7�)#1�d{���7swY�9xYw#t|d�4�d{���7|jd�ddd��d{���7n#1�d{���7swYnxYw|jd�wxYw�wrar+r�s r�6test_jump_out_of_async_with_block_within_finally_blockzCJumpTestCase.test_jump_out_of_async_with_block_within_finally_block9 s����� ��M�M�!��(���3�3��
�
�a� �4�3��M�M�!���
�
�a��4��3��3�3�3��(���3�3��
�
�a� �4�3�3�3�3���M�M�!��s��C+�B�C+�A.�C+�A2�C+�A0�(C+�0C+�2B�8A;�9B�C+�C(�B
�C(�C�/C(�:B=�;C(�C�C
�C�C(�(C+r/)r>rLrNrqrzc�L�|jd�dD]g}|jd�dD]>}|jd� dD]}|jd�� |jd��@|jd��i|jd �y#|jd�wxYw)
Nr>r�rLr�rNr/r�rqrzr�)r
r�r~�ks r�&test_jump_out_of_complex_nested_blocksz3JumpTestCase.test_jump_out_of_complex_nested_blocksC s����
�
�a���A��M�M�!�����
�
�a� �&�#���
�
�a�(�$��M�M�"�%�
�
�M�M�"��� �
�
�b����M�M�"�%�s�B�B#)r>rJrNc��|jd�t|d�5}|jd�ddd�|jd�y#1swY�xYw�Nr>rJrUrNr&r�s r� test_jump_out_of_with_assignmentz-JumpTestCase.test_jump_out_of_with_assignmentR sC���
�
�a��
�&�!�
$���M�M�!��%� �
�
�a��%�
$�s�A
�
Ac���K�|jd�t|d�4�d{���}|jd�ddd��d{���|jd�y7�77�#1�d{���7swY�(xYw�wrir+r�s r�&test_jump_out_of_async_with_assignmentz3JumpTestCase.test_jump_out_of_async_with_assignmentZ sW�����
�
�a��$�V�Q�/�/���M�M�!��0�/� �
�
�a��0��/��/�/�/�sC�"A5�A�A5�A �A5�A�A5�A5� A2�&A)�'A2�.A5)r>rdr/r1c��|jd� |jd�|s |jd�y|jd�|jd�|jd�y#|jd�wxYw)Nr>rLr/rdr1r�r�s r�*test_jump_over_return_in_try_finally_blockz7JumpTestCase.test_jump_over_return_in_try_finally_blockb si���
�
�a�� ��M�M�!����
�M�M�!��
�M�M�!���M�M�!���
�
�a���
�M�M�!��s�A-�A-�-B)r>rLr/r�rqr�c�N�|jd� |jd� |jd�|s |jd�n4|jd�|jd�|jd� |jd�y#|jd�wxYw)Nr>rLrNr�r/rqr�r�r�s r�)test_jump_over_break_in_try_finally_blockz6JumpTestCase.test_jump_over_break_in_try_finally_blockn s����
�
�a����M�M�!��
"��
�
�a� ����
�
�b�!��
�
�a� ��
�
�b�!��M�M�"����
�
�b����
�
�b�!�s�B�B�B$c���|jd�|sdD]}|jd��n"|jd�|jd�|jd�y�Nr>r�rUrdrWr/r�rs r�$test_jump_over_for_block_before_elsez1JumpTestCase.test_jump_over_for_block_before_else~ �M���
�
�a������
�
�a� ��
�M�M�!���M�M�!���
�
�a�rc���K�|jd�|s'tdg�23d{���}|jd��|jd�|jd�|jd�y7�J6��w�Nr>rLrUrdrWr/�rr-rs r�*test_jump_over_async_for_block_before_elsez7JumpTestCase.test_jump_over_async_for_block_before_else� �]�����
�
�a���$�a�S�>�
!�a��
�
�a� ��M�M�!���M�M�!���
�
�a��
!��>��&� A5�A3�A1�A3�AA5�1A3�3A5c�H�|jd�|jd�yr^r�r�s r�test_no_jump_too_far_forwardsz*JumpTestCase.test_no_jump_too_far_forwards� r�rrr�beforec�H�|jd�|jd�yr^r�r�s r�test_no_jump_too_far_backwardsz+JumpTestCase.test_no_jump_too_far_backwards� r�r�exceptc�V� |jd�y#|jd��xYw�NrJrUr�r�s r�test_no_jump_to_except_1z%JumpTestCase.test_no_jump_to_except_1� s)�� ��M�M�!��� ��M�M�!���s��(c�f� |jd�y#t$r|jd��wxYwr��rr�r�s r�test_no_jump_to_except_2z%JumpTestCase.test_no_jump_to_except_2� s1�� ��M�M�!���� ��M�M�!��� �s��0c�p� |jd�y#t$r}|jd�|�d}~wwxYwr�r�r�s r�test_no_jump_to_except_3z%JumpTestCase.test_no_jump_to_except_3� s4�� ��M�M�!���� ��M�M�!���G�� �s�� 5�0�5c�|� |jd�y#ttf$r}|jd�|�d}~wwxYwr�)rr�r�r�s r�test_no_jump_to_except_4z%JumpTestCase.test_no_jump_to_except_4� s9�� ��M�M�!����L�)� ��M�M�!���G�� �s��;�6�;�intoc�V�|jd�dD]}|jd��y)Nr>r�rLr�rs r�$test_no_jump_forwards_into_for_blockz1JumpTestCase.test_no_jump_forwards_into_for_block� s$���
�
�a���A��M�M�!��rc��K�|jd�tddg�23d{���}|jd��7�6y�wr�rwrs r�*test_no_jump_forwards_into_async_for_blockz7JumpTestCase.test_no_jump_forwards_into_async_for_block� s=�����
�
�a�� �!�Q��(� �!��M�M�!�� ��(��s�A�>�<�>�A�>�Ac�V�dD]}|jd��|jd�y)Nr�rJrLr�rs r�%test_no_jump_backwards_into_for_blockz2JumpTestCase.test_no_jump_backwards_into_for_block� s$���A��M�M�!����
�
�a�rz&can't jump into the body of a for loopc��K�tddg�23d{���}|jd��7�6|jd�y�wr�)r-rrs r�+test_no_jump_backwards_into_async_for_blockz8JumpTestCase.test_no_jump_backwards_into_async_for_block� s:���� �!�Q��(� �!��M�M�!�� ��(��
�
�a��s�A�-�+�-�A�-�Ar�c��|jd�t|d�5|jd�ddd�y#1swYyxYwr�r&r�s r�%test_no_jump_forwards_into_with_blockz2JumpTestCase.test_no_jump_forwards_into_with_block� r(r)c���K�|jd�t|d�4�d{���|jd�ddd��d{���y7�&7�#1�d{���7swYyxYw�wr�r+r�s r�+test_no_jump_forwards_into_async_with_blockz8JumpTestCase.test_no_jump_forwards_into_async_with_block� r-r.)r>rJr�c��t|d�5|jd�ddd�|jd�y#1swY�xYwr�rr�s r�&test_no_jump_backwards_into_with_blockz3JumpTestCase.test_no_jump_backwards_into_with_block� rrc���K�t|d�4�d{���|jd�ddd��d{���|jd�y7�77�#1�d{���7swY�(xYw�wr�r!r�s r�,test_no_jump_backwards_into_async_with_blockz9JumpTestCase.test_no_jump_backwards_into_async_with_block� r#r$c��|jd� |jd�|jd�y#|jd�wxYwr4r�r�s r�)test_jump_forwards_into_try_finally_blockz6JumpTestCase.test_jump_forwards_into_try_finally_block� r6r7)rJrUrJrUrNc�� |jd�|jd�|jd�y#|jd�wxYwrr�r�s r�*test_jump_backwards_into_try_finally_blockz7JumpTestCase.test_jump_backwards_into_try_finally_block� r1r2c�x�|jd� |jd�y#|jd��xYwr4r�r�s r�(test_jump_forwards_into_try_except_blockz5JumpTestCase.test_jump_forwards_into_try_except_block
r?r@)rJrJrdc�x� |jd�|jd�y#|jd��xYwr9r�r�s r�)test_jump_backwards_into_try_except_blockz6JumpTestCase.test_jump_backwards_into_try_except_block
r;r<c��� ddz|jd�y#t$r%|jd�|jd�Y�?t$r}|jd�Yd}~�]d}~wwxYwrBrCr�s r�!test_jump_between_except_blocks_2z.JumpTestCase.test_jump_between_except_blocks_2
s]�� �
�a�C� �
�
�a���!� ��M�M�!���M�M�!��!� ��M�M�!���� �s��+A)�A)�A$�$A)c��|jd� |jd�|jd�y#|jd�wxYwr4r�r�s r�test_jump_into_finally_blockz)JumpTestCase.test_jump_into_finally_block!
r6r7)rJrdrWc�� |jd�|jd�|jd�|jd�|jd�y#|jd�|jd�wxYw)NrJrLrNrdrWr�r�s r�+test_jump_into_finally_block_from_try_blockz8JumpTestCase.test_jump_into_finally_block_from_try_block)
s_�� ��M�M�!���M�M�!���M�M�!���M�M�!���
�
�a���
�M�M�!���M�M�!��s�"A�$A<)r>rLr>rLrNc��|jd� |jd�|jd�y#|jd�wxYwr4r�r�s r�test_jump_out_of_finally_blockz+JumpTestCase.test_jump_out_of_finally_block3
r6r7z9can't jump into an 'except' block as there's no exceptionc�z�|jd� |jd�y#|jd�YyxYwr4r�r�s r�#test_no_jump_into_bare_except_blockz0JumpTestCase.test_no_jump_into_bare_except_block;
s2���
�
�a�� ��M�M�!��� ��M�M�!��s�%�:c��|jd� |jd�y#t$r|jd�YywxYwr4�rrvr�s r�(test_no_jump_into_qualified_except_blockz5JumpTestCase.test_no_jump_into_qualified_except_blockC
s:���
�
�a�� ��M�M�!���� ��M�M�!�� �s�%�A�A)rJrNrdc�� |jd�|jd�|jd�y#|jd�|jd��xYw�NrJrLrNrdr/r�r�s r�2test_no_jump_into_bare_except_block_from_try_blockz?JumpTestCase.test_no_jump_into_bare_except_block_from_try_blockK
sO�� ��M�M�!���M�M�!��
�
�
�a��� ��M�M�!���M�M�!���s �"6�%Ac��� |jd�|jd�|jd�y#t$r$|jd�|jd��wxYwr�rKr�s r�7test_no_jump_into_qualified_except_block_from_try_blockzDJumpTestCase.test_no_jump_into_qualified_except_block_from_try_blockV
sY�� ��M�M�!���M�M�!��
�
�
�a��� !� ��M�M�!���M�M�!��� �s �"6�-A#)r>rLrdr>rLrdrWc��|jd� |jd�ddzy#|jd�|jd�YyxYw�Nr>rLrrdrWr�r�s r�"test_jump_out_of_bare_except_blockz/JumpTestCase.test_jump_out_of_bare_except_blocka
sE���
�
�a�� ��M�M�!��
�a�C�� ��M�M�!���M�M�!��s �*�$Ac��|jd� |jd�ddzy#t$r%|jd�|jd�YywxYwr�r�r�s r�'test_jump_out_of_qualified_except_blockz4JumpTestCase.test_jump_out_of_qualified_except_blockk
sM���
�
�a�� ��M�M�!��
�a�C��� ��M�M�!���M�M�!�� �s�*�+A�A)r>rJrNrrc���|jd�t|d�5|jd�ddd�t|d�5|jd�ddd�y#1swY�0xYw#1swYyxYwrNr&r�s r�test_jump_between_with_blocksz*JumpTestCase.test_jump_between_with_blocksu
rPrQc��jK�|jd�t|d�4�d{���|jd�ddd��d{���t|d�4�d{���|jd�ddd��d{���y7�\7�=#1�d{���7swY�MxYw7�?7� #1�d{���7swYyxYw�wrNr+r�s r�#test_jump_between_async_with_blocksz0JumpTestCase.test_jump_between_async_with_blocks}
rTrUc�� |jd�|jd�|jd�y#|jd�|jd�YyxYwrr�r�s r�-test_no_jump_over_return_out_of_finally_blockz:JumpTestCase.test_no_jump_over_return_out_of_finally_block�
sM�� ��M�M�!���M�M�!���M�M�!����
�M�M�!���M�M�!���rc���|jd�|sdD]}|jd��n"|jd�|jd�|jd�yrrr�rs r�'test_no_jump_into_for_block_before_elsez4JumpTestCase.test_no_jump_into_for_block_before_else�
rtrc���K�|jd�|s'tdg�23d{���}|jd��|jd�|jd�|jd�y7�J6��wrvrwrs r�-test_no_jump_into_async_for_block_before_elsez:JumpTestCase.test_no_jump_into_async_for_block_before_else�
ryrzc�6�|jtdddg�y)NrJ�SpamT)r�r�rs r�test_no_jump_to_non_integersz)JumpTestCase.test_no_jump_to_non_integers�
s���
�
�-�q�&�4�&�Arc��t�yr)r�rs r�#test_no_jump_without_trace_functionz0JumpTestCase.test_no_jump_without_trace_function�
s
�� '�(rc�~�i}tddz|�|d}|j|dddgt|jf��y)Na�def f(output): # line 0
x = 0 # line 1
y = 1 # line 2
''' # line 3
%s # lines 4-1004
''' # line 1005
x += 1 # line 1006
output.append(x) # line 1007
return)a�
r!rJi�rr�)r$r��RuntimeWarning�unbound_locals)rr�r!s r�test_large_functionz JumpTestCase.test_large_function�
sQ������'�'�)*� +�
�c�F���
�
�a��D�1�#���@S�@S�/T�
�Urc���tddd��G�fd�d�}t|dd�}tj|j�dgi}t�|�tjd�|j
gd �|d�y)
Nzd
# Comments don't count.
output.append(2) # firstlineno is here.
output.append(3)
output.append(4)
z
<fake module>r$c���eZdZW�Zy)�<JumpTestCase.test_jump_to_firstlineno.<locals>.fake_functionN)rrr r�)r�s�r�
fake_functionr��
s����Hrr�rUr>r
)rJrLrJrLrU)�compiler�r~rr�r$r�)rr�r�r%r�s @r�test_jump_to_firstlinenoz%JumpTestCase.test_jump_to_firstlineno�
sw�����
�f��� � ��M�1�a�0�����V�\�\�"��r�N� ��T�9�����T��� � ��)�H�2E�FrrAz5can't jump from the 'call' trace event of a new frame)r�r�c�b���jd��fd�}|��jd�y)Nr>c�(���jd�yrr�r�s�r�nestedz3JumpTestCase.test_no_jump_from_call.<locals>.nested�
s����M�M�!�rrNr�)r
r�s` r�test_no_jump_from_callz#JumpTestCase.test_no_jump_from_call�
s'��� �
�
�a�� ����
�
�a�rrEz'can only jump from a 'line' trace eventc�&�|jd�yr=r�r�s r�test_no_jump_from_return_eventz+JumpTestCase.test_no_jump_from_return_event�
s�� �
�
�a��rr{c�0�|jd�ddzyrr�r�s r�!test_no_jump_from_exception_eventz.JumpTestCase.test_no_jump_from_exception_event�
s�� �
�
�a�� �A�r)r�c�R���fd�}t|���jd�y)Nc3�8�K��jd�d��y�w)NrJrLr�r�s�rrFz.JumpTestCase.test_jump_from_yield.<locals>.gen�
s������M�M�!���G�s�rN)rCr)r
rFs` r�test_jump_from_yieldz!JumpTestCase.test_jump_from_yield�
s��� �
�S�U���
�
�a�rc��|jd�td�D�cgc]}|��}}|jd�ycc}w�Nr>r�rL�rr`�r
r�r,s r�test_jump_forward_over_listcompz,JumpTestCase.test_jump_forward_over_listcomp�
s7���
�
�a���b� �"� �1�Q� ��"��
�
�a���
#s� <c�F�d}td�D�cgc]}|��}}d}ycc}wr�r_�r
rar�r,r�s r� test_jump_backward_over_listcompz-JumpTestCase.test_jump_backward_over_listcomp�
s)��
���b� �"� �1�Q� ��"�
���
#s� )rJrWrJc��d}|jd�|rytd�D�cgc]}|��}}d}|jd�|jd�ycc}w�NFrJrNrdrWr/r��r
�flagr�r,s r�#test_jump_backward_over_listcomp_v2z0JumpTestCase.test_jump_backward_over_listcomp_v2�
sS�����
�
�a�����a��!��1�Q���!����
�
�a���
�
�a���
"s� Ac��K�|jd�ttd��2�cgc3d{���}|��7�6ncc}w}}|jd�y�wr��rr-r`r�s r�%test_jump_forward_over_async_listcompz2JumpTestCase.test_jump_forward_over_async_listcompsD�����
�
�a��'��b� �2�3�3��Q�3��3��3��3��
�
�a��s&�(A�<�:�8
�:�<�:�<�Ac��rK�d}ttd��2�cgc3d{���}|��7�6ncc}w}}d}y�wr�)r-r`r�s r�&test_jump_backward_over_async_listcompz3JumpTestCase.test_jump_backward_over_async_listcomp
s6����
��'��b� �2�3�3��Q�3��3��3��3�
��s$�7�-�+�)
�+�-�+�-�7c���K�d}|jd�|ryttd��2�cgc3d{���}|��7�6ncc}w}}d}|jd�|jd�y�wr�r�r�s r�)test_jump_backward_over_async_listcomp_v2z6JumpTestCase.test_jump_backward_over_async_listcomp_v2s`�������
�
�a����'��a��1�2�2��Q�2��2��2��2����
�
�a���
�
�a��s*�-A-�A�?�=
�?�A�?�A�-A-)r�c��d}t|jd��|jd�|dzdz|jd�y�Nr>rLrNr�r�r&�r�r�r
ras r�(test_jump_with_null_on_stack_load_globalz5JumpTestCase.test_jump_with_null_on_stack_load_globalsN��
��
��M�M�!��
� �
�
�a�����
�
� �
�
�b�rc��d}t}||jd��|jd�|dzdz|jd�y)Nr>rUrdrqrs�r�)r
rar!s r�&test_jump_with_null_on_stack_push_nullz3JumpTestCase.test_jump_with_null_on_stack_push_null/sS��
���� ��M�M�!��
� �
�
�a�����
�
� �
�
�b�rc��d}tj|d�|jd�|dzdz|jd�yr�)�listrr�s r�&test_jump_with_null_on_stack_load_attrz3JumpTestCase.test_jump_with_null_on_stack_load_attrCsK��
������A�
� �
�
�a�����
�
� �
�
�b�rc�z�|jd�|jd�xsd�^}}}|jd�y�Nr>rJr�rLr��r
rHs r�(test_jump_extended_args_unpack_ex_simplez5JumpTestCase.test_jump_extended_args_unpack_ex_simpleUs3���
�
�a���=�=��#�-�v���A�q��
�
�a�r)r>rUrUrNc�z�|jd�|jd�xsd�^}}}|jd�y)Nr>rUr�rNr�rs r�(test_jump_extended_args_unpack_ex_trickyz5JumpTestCase.test_jump_extended_args_unpack_ex_tricky[s9���
�
�a��
�M�M�!��&��
�
��1��
�
�a�r�cpuc���dddgd�tdd�D��d�}i}tdj|�|�|d }|j|d
dddgt|j
f��y)
Nzdef f(output):z output.append(1)z for _ in spam:c3�(K�|]
}d|�d����y�w)z output.append(�)Nr"�r�r�s rr�z@JumpTestCase.test_jump_extended_args_for_iter.<locals>.<genexpr>ks����
G�5F��&�q�c��+�5F���rLi��z output.append(100_000)r�r!rJr>r�)r`r$r�r�r�r�)r�sourcer%r!s r� test_jump_extended_args_for_iterz-JumpTestCase.test_jump_extended_args_for_itercs}��
�"� �
�H�U�1�g�5F�
G�
�
)�
��� ��T�Y�Y�v�
� �*��c�N���
�
�a�!�W�q�'�l�^�T�M`�M`�<a�
�brc�r�|jd�|jd�xrd}|jd�yr�r�rs r�test_jump_or_popzJumpTestCase.test_jump_or_popss-���
�
�a���M�M�!��'����
�
�a�r)NrCFN)NrCN)trrr r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r;rrrrr r�rrr�rrrrrr"r'r,r0r5r:r>rErGrIrLrOrSrXrZr]r_rbrdrgrjrlrnrprsrxr|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�r�r�r�r�r�r�r�r�r�rrr�requires_resourcerr
r"rrr�r��sV
��>�N��6�@D�8<�3�.FJ�8<�3�*
�
��q�!�a�S�����
�q�!�Y��� ���q�!�a�S�>�>�"B�C��D���q�!�Y��� ���q�!�a�S������q�!�Y��� ���q�!�a��V�n�n�%E�F��G���q�!�-�.��/���Q��A�q�6�"����#���Q��-�.����/���q�!�a�S�����
�q�!�Y��� ���q�!�a��V�� �� ��q�!�a��V�/��4�5��6���q�"�q�"�g� 1�2�6�7��8���q�"�q�!�f�z�+O�P�Q��R���q�!�a�S�:�w�/�0��1���q�!�a��V������q�!�\�"��#���q�!�a��V�����
�Q��A�q�6�"��#��
�q�!�(�)��*��
�Q��.�/��0��
�q�!�a�S������q�!�\�"��#���q�!�a�S������q�!�Y��� ���q�!�Y��� ���q�!�Y��� ���q�!�Y��� ���q�!�\�N�N�+K�L��M���q�!�]�#��$���Q��=�)��*���q�!�\�"��#���Q��<�(��)���q�!�(�)��*���Q��.�/��0���q�!�\�"��#���Q��<�(��)���q�"�'�(��)���q�!�Y���(H�I��J���Q��9�~�~�.N�O��P���q�!�\�"� �#� ��q�!�*�+�
�,�
��q�!�a��V�n�n�%E�F��G���Q��A�q�6�N�N�+K�L��M���q�!�a�S�:�w�/�0��1���q�"�q�c�J��1�2��3��
�q�!�a�S�:�x�0�1��2���q�!�a�S�:�x�0�1��2���q�!�a�S�:�x�0�1��2���q�!�a�S�:�x�0�1��2���q�!�R�*�f�-�.��/��
�Q��2�
�F�3�4�
�5�
��q�!�a��V�j�&�1�2��3���Q��A�q�6�J�0X�#Y�Z��[��
�q�!�R�*�g�.�/��0��
�Q��2�
�G�4�5��6��
�q�!�Z�*�g�!6�7��8��
�Q��:�
�G�'<�=��>��
�q�!�a��V������q�!�_�%��&���q�!�a�S������q�!�Y��� ���q�!�Y���(H�I��J���q�!�a�S������q�!�Y��� ���q�!�_�%��&���q�!�R�*�&a�b�c��d���q�!�R�*�&a�b�c��d���q�!�Y��-h� i�j��k���q�!�a�S�:�'b�c�d��e���q�!�*�+��,���q�!�*�+��,���q�!�]�#��$���Q��=�)��*���q�!�a��V�j�'�2�3��4���q�!�a��V�j�&�1�2��3���Q��A�q�6�J��#7�8��9��B�)�
V�G�&�q�!�a�S��z�<8�/9�:��:���q�!�a�S���8�1:�;��;���q�!�a�S��J�8�4:�;��;���q�!�a��V�8�,��-���q�!�a��V�n�n�%E�F��G���q�!�R�.�.�!A�B��C��
�q�!�Y���(H�I��J���Q��A�q�6�N�N�+K�L��M��
�Q��2���'G�H��I��
�Q��9�~�~�.N�O��P���q�!�R�
�G�4�5��6��$�q�!�R�
�G�4�5��6��&�q�!�R�
�G�4�5��6��"�q�!�a��V�n�n�%E�F��G��
�q�!�\�N�N�+K�L��M���W���u�%�
c�&�
c��q�!�a��V�n�n�%E�F��G�rr�c�$�eZdZd�Zd�Zd�Zd�Zy)�TestExtendedArgsc��|jtjtj��tjd�yrr}rs rr�zTestExtendedArgs.setUp|r�rc����td�D] }|��dddd����fd��tj��|�tjd��S)N�r�rArCrEc�"���|xxdz
cc<�Sr=r")r�r�r��countsr�s ��rr�z,TestExtendedArgs.count_traces.<locals>.trace�s����5�M�Q��M��Lr)r`r~r)rr�rHrr�s @@r�count_traceszTestExtendedArgs.count_traces�sM����r��A��F���Q�!�4�� � ���U�������T���
rc�x�i}d}t||�|j|d�}|j|dddd��y)Na"def f():
(y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
y,
) = range(300)r!r>i-r)r$rrL)r�nsr�rs r�test_trace_unpack_long_sequencez0TestExtendedArgs.test_trace_unpack_long_sequence�s@��
��A���T�2���"�"�2�c�7�+������!�S�A�!F�Grc�d�tdttjdz��}dj djd�t
|�D���}t
|�D�cic]}d|��|��
}}t||�|j|d�}|j|d|d zdd
��ycc}w)Ni�g�������?zeif 1:
def f():
return (
{}
)
z
+
c3�(K�|]
}d|�d����y�w)�varr�Nr"rs rr�z>TestExtendedArgs.test_trace_lots_of_globals.<locals>.<genexpr>�s����B�\��#�a�S���\�r rr!r>rJr)
�min�intr�C_RECURSION_LIMIT�formatr�r`r$rrL)rr^r�r�rrs r�test_trace_lots_of_globalsz+TestExtendedArgs.test_trace_lots_of_globals�s����D�#�g�7�7�#�=�>�?���
�F�7�<�<�B�U�5�\�B�B�C�
�%*�%�L�
1�L�q��A�3�i��l�L��
1��T�2���"�"�2�c�7�+������!�U�Q�Y�!�!L�M��2s�$
B-N)rrr r�rrr"r"rrrrzs���� H�Nrrc��eZdZd�Zd�Zd�Zy)�
TestEdgeCasesc��|jtjtj��tjd�yrr}rs rr�zTestEdgeCases.setUp�r�rc����d�}d��G�fd�d�}tj|��tj|�|jtj���y)Nc��yrr"r�s rr�z*TestEdgeCases.test_reentrancy.<locals>.foo����rc��yrr"r�s r�barz*TestEdgeCases.test_reentrancy.<locals>.bar�r(rc���eZdZd�Z�fd�Zy)�(TestEdgeCases.test_reentrancy.<locals>.Ac��yrr")rr7s r�__call__z1TestEdgeCases.test_reentrancy.<locals>.A.__call__�r�rc�0��tj��yr)r~r)rr*s �r�__del__z0TestEdgeCases.test_reentrancy.<locals>.A.__del__�s������S�!rN)rrr r.r0)r*s�rr�r,�s
���
�
"rr�)r~rrLr�)rr�r�r*s @r�test_reentrancyzTestEdgeCases.test_reentrancy�sI��� � � "� "� ���Q�S�����S����������-rc��d�}tj|�~tjtj��y)Nc��yrr"r�s rr�z+TestEdgeCases.test_same_object.<locals>.foo�r(rr�)rr�s r�test_same_objectzTestEdgeCases.test_same_object�s*�� � ���S������S�\�\�^�$rN)rrr r�r1r4r"rrr$r$�s���.�&%rr$c��eZdZd�Zy)�TestLinesAfterTraceStartedc�P�t�}|jtj�_tj
|j�d}d}tj
d�|j
tjjj|jgd��y)NrUrN)rTrMrc)r�r�r~r�r�rr�r6�test_eventsr�r�r�)rr�rCs rr8z&TestLinesAfterTraceStarted.test_events�sp�����"(�,�,��
�
������V�\�\�"��������T�����&�2�2�;�;�J�J��M�M�� rN)rrr r8r"rrr6r6�s��rr6c��eZdZd�Zy)�TestSetLocalTracec�������fd��dd�}gd�}g�tj���tj�_|�|j �|�tjd�y)Nc���|jjdk(r=�|_|j|jjz
}�j||f��S)Nr�)r[r\r�r�r�r)r�r�r�rCr�r�s ��rr�z7TestSetLocalTrace.test_with_branches.<locals>.tracefunc�sJ����|�|�#�#�v�-� )��
��~�~����(C�(C�C���
�
�t�U�m�,��rc�8�d}|dk\rd}nd}|dk\rd}d}yd}d}y)Nr>rJrLrNrWr1r�r")r��N�not_reached�reached�the_ends rr�z2TestSetLocalTrace.test_with_branches.<locals>.func�s7���A��a�x������a�x����G����Gr)r@rBrIrMrcr0ror�r�)r~rr�r�rL)rr�rMr�r�s @@r�test_with_branchesz$TestSetLocalTrace.test_with_branches�sV��� �
�
�������Y��"+��
�
����������1����T�rN)rrr rBr"rrr:r:�s��%rr:�__main__)9r9r�unittestr~r�r�� functoolsrr��test.supportrr�r��requires_working_socketr r$r-r;r?r�rHrQrSrZrbrirmrArwryr�r�r�r�r�r�r�r�r�r��TestCaser�rKrirgrsr{r�r�r�r�rr$r6r:r�mainr"rr�<module>rJsc����
�� ���&�������t�,�
(�
(�
(�
(��
�
����
�'���
�'����'���
�
(���� %���
�'�
��
�
�����
�
$�
��/�$�,�_����
�,���
�)���
�+���"
�+����� -�)�+�6��;�
<�)�-�8�9�����0p1�H�%�%�p1�f+�� /�-� /� ���0�=�0��0�g3�x�0�0�g3�\#�#�L+�H�]�8�$�$�]�@)N�x�(�(�)N�X%�H�%�%�%�D���"'�
�'�T�z���H�M�M�O�r
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists