HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_sys_setprofile.cpython-310.opt-1.pyc
o

�i�4�@s�ddlZddlZddlZddlZddlmZGdd�dej�ZGdd�d�ZGdd�de�Z	Gd	d
�d
ej�Z
Gdd�de
�ZGd
d�de
�Zdd�Z
dd�Ze
e�Zddd�Zdd�ZGdd�dej�Zedkroe��dSdS)�N)�supportc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestGetProfilecC�t�d�dS�N��sys�
setprofile��self�r�5/usr/local/lib/python3.10/test/test_sys_setprofile.py�setUp	�zTestGetProfile.setUpcCrrrr	rrr�tearDownrzTestGetProfile.tearDowncCs|�t���dSr)ZassertIsNoner�
getprofiler	rrr�
test_emptyszTestGetProfile.test_emptycCs&dd�}t�|�|�t��|�dS)NcW�dSrr��argsrrr�fn�z&TestGetProfile.test_setget.<locals>.fn)rrZassertIsr)r
rrrr�test_setgets
zTestGetProfile.test_setgetN)�__name__�
__module__�__qualname__r
rrrrrrrrs
rc@s.eZdZdd�Zdd�Zd
dd�Zdd	�ZdS)�HookWatchercCsg|_g|_dSr)�frames�eventsr	rrr�__init__s
zHookWatcher.__init__cCs,|dks|dks|dkr|�||�dSdS)N�call�return�	exception��	add_event�r
�frame�event�argrrr�callbacks
�zHookWatcher.callbackNcCsf|dur	t�d�}z|j�|�}Wnty%t|j�}|j�|�Ynw|j�||t|�f�dS)zAdd an event to the log.N�)	r�	_getframer�index�
ValueError�len�appendr�ident)r
r&r%Zframenorrrr#$s

�zHookWatcher.add_eventcs.t|jj�tt�g�d|_�fdd�|jD�S)zRemove calls to add_event().Ncsg|]
}|d�vr|�qS)�r)�.0�item�Z
disallowedrr�
<listcomp>6sz*HookWatcher.get_events.<locals>.<listcomp>)r/r#�__func__rrr	rr3r�
get_events1szHookWatcher.get_eventsr)rrrrr(r#r6rrrrrs


rc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zeeeeeed
�Z	dS)�ProfileSimulatorcCs||_g|_t�|�dSr)�testcase�stackrr)r
r8rrrr:szProfileSimulator.__init__cCs|j|||�dSr)�dispatchr$rrrr(?szProfileSimulator.callbackcCs|�d|�|j�|�dS)Nr)r#r9r.�r
r%rrr�
trace_callCszProfileSimulator.trace_callcCs|�d|�|j��dS)Nr )r#r9�popr;rrr�trace_returnGszProfileSimulator.trace_returncCs|j�d�dS)Nz2the profiler should never receive exception events)r8�failr;rrr�trace_exceptionKs�z ProfileSimulator.trace_exceptioncCrrrr;rrr�
trace_passOrzProfileSimulator.trace_pass)rr!r Zc_callZc_returnZc_exceptionN)
rrrrr(r<r>r@rAr:rrrrr79s
�r7c@seZdZdd�ZdS)�TestCaseBasecCs<t||���}||kr|�dt�|�t�|�f�dSdS)Nz'Expected events:
%s
Received events:
%s)�capture_events�new_watcherr?�pprintZpformat)r
�callableZexpectedrrrr�check_events]s
��zTestCaseBase.check_eventsN)rrrrGrrrrrB\srBc@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ProfileHookTestCasecCst�Sr)rr	rrrrDe�zProfileHookTestCase.new_watchercC�0dd�}t|�}|�|dd|fdd|fg�dS)NcSrrr��prrr�firz*ProfileHookTestCase.test_simple.<locals>.fr)rr �r/rG�r
rM�f_identrrr�test_simpleh�

�zProfileHookTestCase.test_simplecCrJ)NcS�dddS�Nr)rrrKrrrrMq�z-ProfileHookTestCase.test_exception.<locals>.fr)rr rNrOrrr�test_exceptionprRz"ProfileHookTestCase.test_exceptioncCrJ)NcS�zddWdSYdSrTrrKrrrrMy�z4ProfileHookTestCase.test_caught_exception.<locals>.fr)rr rNrOrrr�test_caught_exceptionx�

�z)ProfileHookTestCase.test_caught_exceptioncCrJ)NcSrWrTrrKrrrrM�rXz;ProfileHookTestCase.test_caught_nested_exception.<locals>.fr)rr rNrOrrr�test_caught_nested_exception�rZz0ProfileHookTestCase.test_caught_nested_exceptioncCrJ)NcSrSrTrrKrrrrM�rUz4ProfileHookTestCase.test_nested_exception.<locals>.fr)rr rNrOrrr�test_nested_exception�s

�z)ProfileHookTestCase.test_nested_exceptioncsddd���fdd�}t��}t|�}|�|dd|fdd|fdd|fd	d|fd	d|fdd|fg�dS)
NcSrSrTrrKrrrrM�rUz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.fc	s6z�|�WdSz�|�WYdSYYdSrrrK�rMrr�g�s
z>ProfileHookTestCase.test_exception_in_except_clause.<locals>.gr)rr0r �rN�r
r^rP�g_identrr]r�test_exception_in_except_clause�s
�z3ProfileHookTestCase.test_exception_in_except_clausec
s\dd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd	|fdd|fg�dS)
NcSrSrTrrKrrrrM�rUz9ProfileHookTestCase.test_exception_propagation.<locals>.fc	s&z�|�W|�d�dS|�d�w)N�falling throughr"rKr]rrr^�sz9ProfileHookTestCase.test_exception_propagation.<locals>.gr)rr0r rcrNr`rr]r�test_exception_propagation�s
�z.ProfileHookTestCase.test_exception_propagationcCrJ)NcSs$zddWdSddYdSrTrrKrrrrM�sz/ProfileHookTestCase.test_raise_twice.<locals>.fr)rr rNrOrrr�test_raise_twice�rZz$ProfileHookTestCase.test_raise_twicecCrJ)NcSszddWdS�rTrrKrrrrM�sz1ProfileHookTestCase.test_raise_reraise.<locals>.fr)rr rNrOrrr�test_raise_reraise�rZz&ProfileHookTestCase.test_raise_reraisecCrJ)NcSst��r)�	ExceptionrKrrrrM�rIz)ProfileHookTestCase.test_raise.<locals>.fr)rr rNrOrrr�
test_raise�rRzProfileHookTestCase.test_raisec�dd���fdd���fdd���fdd���fd	d
�}t��}t��}t��}t��}t|�}|�|dd|fd
d|fdd|fdd|fdd|fdd|fdd|fdd|fd
d|fdd|fg
�dS)NcSrSrTrrrrrrM�rUz5ProfileHookTestCase.test_distant_exception.<locals>.fc�
��dSrrrr]rrr^��
z5ProfileHookTestCase.test_distant_exception.<locals>.gcrjrrr�r^rr�h�rkz5ProfileHookTestCase.test_distant_exception.<locals>.hcrjrrr�rmrr�i�rkz5ProfileHookTestCase.test_distant_exception.<locals>.icrjrrrK�rorr�j�rkz5ProfileHookTestCase.test_distant_exception.<locals>.jr)rr0r_��r rN�r
rqrPraZh_identZi_identZj_identr�rMr^rmror�test_distant_exception��*
�z*ProfileHookTestCase.test_distant_exceptionc
�tdd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�dS)	Ncs��td�D]}|VqdS�Nr0��rangerprrrrM����z-ProfileHookTestCase.test_generator.<locals>.fc���D]}qdSrr�rLror]rrr^��
�z-ProfileHookTestCase.test_generator.<locals>.gr)rr0r rNr`rr]r�test_generator�s
�z"ProfileHookTestCase.test_generatorc
rx)	Ncsryrzr{rprrrrMr}z2ProfileHookTestCase.test_stop_iteration.<locals>.fcr~rrrr]rrr^r�z2ProfileHookTestCase.test_stop_iteration.<locals>.gr)rr0r rNr`rr]r�test_stop_iterations
�z'ProfileHookTestCase.test_stop_iterationN)rrrrDrQrVrYr[r\rbrdrerfrhrvr�r�rrrrrHds				rHc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�ProfileSimulatorTestCasecCst|�Sr)r7r	rrrrDsz$ProfileSimulatorTestCase.new_watchercCrJ)NcSrrrrKrrrrMrz/ProfileSimulatorTestCase.test_simple.<locals>.fr)rr rNrOrrrrQrRz$ProfileSimulatorTestCase.test_simplecCrJ)NcSrSrTrrKrrrrM&rUz8ProfileSimulatorTestCase.test_basic_exception.<locals>.fr)rr rNrOrrr�test_basic_exception%rRz-ProfileSimulatorTestCase.test_basic_exceptioncCrJ)NcSrWrTrrKrrrrM.rXz9ProfileSimulatorTestCase.test_caught_exception.<locals>.fr)rr rNrOrrrrY-rZz.ProfileSimulatorTestCase.test_caught_exceptioncri)NcSrSrTrrrrrrM7rUz:ProfileSimulatorTestCase.test_distant_exception.<locals>.fcrjrrrr]rrr^9rkz:ProfileSimulatorTestCase.test_distant_exception.<locals>.gcrjrrrrlrrrm;rkz:ProfileSimulatorTestCase.test_distant_exception.<locals>.hcrjrrrrnrrro=rkz:ProfileSimulatorTestCase.test_distant_exception.<locals>.icrjrrrKrprrrq?rkz:ProfileSimulatorTestCase.test_distant_exception.<locals>.jr)rr0r_rrrsr rNrtrrurrv6rwz/ProfileSimulatorTestCase.test_distant_exceptionc�8i��fdd�}t|�}|�|dd|fdd|fg�dS)Ncstjidfi���dS�N�*��dict�getrK��kwargsrrrMU�z7ProfileSimulatorTestCase.test_unbound_method.<locals>.fr)rr rNrOrr�r�test_unbound_methodS�
�z,ProfileSimulatorTestCase.test_unbound_methodcCrJ)NcSst��dSrr�rKrrrrM]rUz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.fr)rr rNrOrrr�test_unbound_method_no_args\rRz4ProfileSimulatorTestCase.test_unbound_method_no_argscCrJ)NcSst�td�dSr��r�r��printrKrrrrMeszDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.fr)rr rNrOrrr� test_unbound_method_invalid_argsdrRz9ProfileSimulatorTestCase.test_unbound_method_invalid_argscr�)Ncstjdi���dS)Nrr�rKr�rrrMnszGProfileSimulatorTestCase.test_unbound_method_no_keyword_args.<locals>.fr)rr rNrOrr�r�#test_unbound_method_no_keyword_argslr�z<ProfileSimulatorTestCase.test_unbound_method_no_keyword_argscr�)Ncstjtdfi���dSr�r�rKr�rrrMwr�zLProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args.<locals>.fr)rr rNrOrr�r�(test_unbound_method_invalid_keyword_argsur�zAProfileSimulatorTestCase.test_unbound_method_invalid_keyword_argsN)
rrrrDrQr�rYrvr�r�r�r�r�rrrrr�s			r�cCs$t|d�r	|j}n|j}|j|jfS)N�f_code)�hasattrr��__code__�co_firstlineno�co_name)�function�coderrrr/~s
r/cCsz||�WdSYdSrr)rMrLrrr�protect�rXr�cCsp|durt�}t��}t��zt�|j�t||�t�d�W|r't��n|r/t��ww|�	�dd�S)Nr)���)
r�gc�	isenabled�disablerrr(r��enabler6)rFrLZold_gcrrrrC�s
��
�rCcCsddl}|�t|��dS)Nr)rErC)rFrErrr�show_events�sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�
TestEdgeCasescCs |�tjt���t�d�dSr)Z
addCleanuprrrr	rrrr
�szTestEdgeCases.setUpcs�dd�}dd��G�fdd�d�}t�|��t���}t�|�|�|jj|j�|�|jj	t
�Wd�n1s<wY|�t��|�dS)NcWrrrrrrr�foo�rz*TestEdgeCases.test_reentrancy.<locals>.foocWrrrrrrr�bar�rz*TestEdgeCases.test_reentrancy.<locals>.barcs eZdZdd�Z�fdd�ZdS)z(TestEdgeCases.test_reentrancy.<locals>.AcWrrr)r
rrrr�__call__�rz1TestEdgeCases.test_reentrancy.<locals>.A.__call__cst���dSrrr	�r�rr�__del__�rz0TestEdgeCases.test_reentrancy.<locals>.A.__del__N)rrrr�r�rr�rr�A�sr�)rrrZcatch_unraisable_exceptionZassertEqualZ
unraisable�objectr�ZassertIsInstance�	exc_value�RuntimeErrorr)r
r�r��cmrr�r�test_reentrancy�s

�zTestEdgeCases.test_reentrancycCs&dd�}t�|�~t�t���dS)NcWrrrrrrrr��rz+TestEdgeCases.test_same_object.<locals>.foo)rrr)r
r�rrr�test_same_object�s
zTestEdgeCases.test_same_objectN)rrrr
r�r�rrrrr��sr��__main__r)r�rErZunittest�testrZTestCaserrr7rBrHr�r/r�Z
protect_identrCr�r�r�mainrrrr�<module>s* #6e
&�