python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_sys_setprofile.cpython-312.opt-2.pyc

Αe5PddlZddlZddlZddlZGddejZGddZGddeZGdd	ejZGd
deZ	Gdd
eZ
dZdZeeZ
ddZdZGddejZedk(rej$yy)Nc$eZdZdZdZdZdZy)TestGetProfilec.tjdyNsys
setprofileselfs L/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_sys_setprofile.pysetUpzTestGetProfile.setUptc.tjdyrrr
s rtearDownzTestGetProfile.tearDownrrcJ|jtjyr)assertIsNoner
getprofiler
s r
test_emptyzTestGetProfile.test_emptys#..*+rc|d}tj||jtj|y)Ncyrargss rfnz&TestGetProfile.test_setget.<locals>.fnr)rr	assertIsr)rrs  rtest_setgetzTestGetProfile.test_setgets*		r

cnn&+rN)__name__
__module____qualname__r
rrrrrrrrs,,rrc&eZdZdZdZddZdZy)HookWatcherc g|_g|_yr)frameseventsr
s r__init__zHookWatcher.__init__srcH|dk(s
|dk(s|dk(r|j||yy)Ncallreturn	exception	add_eventrframeeventargs    rcallbackzHookWatcher.callbacks,VO #NN5%($rNc8	|tjd}	|jj|}|jj
||t|fy#t$r3t|j}|jj
|YcwxYw)N)	r	_getframer%index
ValueErrorlenappendr&ident)rr0r/framenos    rr-zHookWatcher.add_event#s&=MM!$E	&kk''.G
	
GUE%L9:		&$++&GKKu%	&sA9BBc	t|jjttg}d|_|jDcgc]}|d|vs|c}Scc}wN)r:r-__func__r%r&)r
disalloweditems   r
get_eventszHookWatcher.get_events0sL*DNN334eElC
!%JQz0IJJJsAAr)rr r!r'r2r-rBrrrr#r#s);Krr#cBeZdZdZdZdZdZdZdZeeeeeedZ	y)	ProfileSimulatorcJ||_g|_tj|yr)testcasestackr#r')rrFs  rr'zProfileSimulator.__init__9s 

T"rc0|j|||yr)dispatchr.s    rr2zProfileSimulator.callback>s

eT5)rc^|jd||jj|y)Nr))r-rGr9rr/s  r
trace_callzProfileSimulator.trace_callBs"vu%

% rc\|jd||jjy)Nr*)r-rGpoprKs  rtrace_returnzProfileSimulator.trace_returnFsx'

rc:|jjdy)Nz2the profiler should never receive exception events)rFfailrKs  rtrace_exceptionz ProfileSimulator.trace_exceptionJs

@	BrcyrrrKs  r
trace_passzProfileSimulator.trace_passNsr)r)r+r*c_callc_returnc_exceptionN)
rr r!r'r2rLrOrRrTrIrrrrDrD8s<#
*!B
$!

HrrDceZdZdZy)TestCaseBasect||j}||k7r>|jdtj|dtj|yy)NzExpected events:
z
Received events:
)capture_eventsnew_watcherrQpprintpformat)rcallableexpectedr&s    rcheck_eventszTestCaseBase.check_events\sN$*:*:*<=XII16>>&3IK
LrN)rr r!rarrrrYrY[sLrrYc`eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZy)ProfileHookTestCasectSr)r#r
s rr\zProfileHookTestCase.new_watcherds
}rcTd}t|}|j|dd|fdd|fgy)Ncyrrps rfz*ProfileHookTestCase.test_simple.<locals>.fhrrr4r)r*r:rarrif_idents   rtest_simplezProfileHookTestCase.test_simpleg8	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)NcddzyNr4rrrgs rriz-ProfileHookTestCase.test_exception.<locals>.fp	
aCrr4r)r*rjrks   rtest_exceptionz"ProfileHookTestCase.test_exceptiono8	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Ncddzy#YyxYwrqrrgs rriz4ProfileHookTestCase.test_caught_exception.<locals>.fx1Dr4r)r*rjrks   rtest_caught_exceptionz)ProfileHookTestCase.test_caught_exceptionw:	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Ncddzy#YyxYwrqrrgs rriz;ProfileHookTestCase.test_caught_nested_exception.<locals>.frwrxr4r)r*rjrks   rtest_caught_nested_exceptionz0ProfileHookTestCase.test_caught_nested_exceptionrzrcTd}t|}|j|dd|fdd|fgy)Ncddzyrqrrgs rriz4ProfileHookTestCase.test_nested_exception.<locals>.frrrr4r)r*rjrks   rtest_nested_exceptionz)ProfileHookTestCase.test_nested_exceptions:	(!q&'2 !(G4	 	!rcdfd}t}t|}|j|dd|fdd|fdd|fdd|fdd|fdd|fgy)Ncddzyrqrrgs rriz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.frrrcF	|y#|Yy#YYyxYwxYwrrrhris rgz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.gs#
!
qTs   r4r)r>r*rjrrrlg_identris    @rtest_exception_in_except_clausez3ProfileHookTestCase.test_exception_in_except_clausesq		((!q&'2 &'2 (G4 &'2 (G4 (G4 	!rc
dfd}t}t|}|j|dd|fdd|fdd|fdd|fdd|fgy)Ncddzyrqrrgs rriz9ProfileHookTestCase.test_exception_propagation.<locals>.frrrcd||jdy#|jdwxYw)Nfalling throughr,rs rrz9ProfileHookTestCase.test_exception_propagation.<locals>.gs%1[[!23Q[[!23s/r4r)r>r*rrjrs    @rtest_exception_propagationz.ProfileHookTestCase.test_exception_propagationsh		4((!q&'2 &'2 (G4 "3W= (G4	 	!rcTd}t|}|j|dd|fdd|fgy)Nc&ddzy#ddzYyxYwrqrrgs rriz/ProfileHookTestCase.test_raise_twice.<locals>.fs1AaCsr4r)r*rjrks   rtest_raise_twicez$ProfileHookTestCase.test_raise_twices:	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Ncddzy#xYwrqrrgs rriz1ProfileHookTestCase.test_raise_reraise.<locals>.fs1Es
r4r)r*rjrks   rtest_raise_reraisez&ProfileHookTestCase.test_raise_reraises:	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Nctr)	Exceptionrgs rriz)ProfileHookTestCase.test_raise.<locals>.fs
+rr4r)r*rjrks   r
test_raisezProfileHookTestCase.test_raises8	(!q&'2 (G4 	!rc	
dfdfd		fd

fd}t}t}t	}t
}t|}|j|dd|fdd|fd	d|fd
d|fdd|fdd|fd
d|fd	d|fdd|fdd|fg
y)
Ncddzyrqrrrrriz5ProfileHookTestCase.test_distant_exception.<locals>.frrrcyrrrisrrz5ProfileHookTestCase.test_distant_exception.<locals>.g
Crcyrrrsrhz5ProfileHookTestCase.test_distant_exception.<locals>.hrrcyrrrsriz5ProfileHookTestCase.test_distant_exception.<locals>.irrcyrrrhrs rjz5ProfileHookTestCase.test_distant_exception.<locals>.jrrr4r)r>rr*rjrrrlrh_identi_identj_identrirrrs       @@@@rtest_distant_exceptionz*ProfileHookTestCase.test_distant_exception					(((((!q&'2 &'2 &'2 &'2 &'2 (G4 (G4 (G4 (G4 (G4
 
	!rc
dfd}t}t|}|j|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fgy)Nc34KtdD]}|ywr=rangers rriz-ProfileHookTestCase.test_generator.<locals>.f1X

cD]}yrrrhrris  rrz-ProfileHookTestCase.test_generator.<locals>.gS

rr4r)r>r*rjrs    @rtest_generatorz"ProfileHookTestCase.test_generators		((!q&'2 &'2 (G4 &'2 (G4 !&'2 (G4 (G4 	!rc
dfd}t}t|}|j|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fgy)Nc34KtdD]}|ywr=rrs rriz2ProfileHookTestCase.test_stop_iteration.<locals>.frrcD]}yrrrs  rrz2ProfileHookTestCase.test_stop_iteration.<locals>.grrr4r)r>r*rjrs    @rtest_stop_iterationz'ProfileHookTestCase.test_stop_iterations		((!q&'2 &'2 (G4 &'2 (G4 &'2 (G4 (G4
 
	!rN)rr r!r\rmrsryr}rrrrrrrrrrrrrcrccsH!!!!	!!&
!!!!!8!,!rrccHeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)ProfileSimulatorTestCasect|Sr)rDr
s rr\z$ProfileSimulatorTestCase.new_watchers
%%rcTd}t|}|j|dd|fdd|fgy)Ncyrrrgs rriz/ProfileSimulatorTestCase.test_simple.<locals>.frrr4r)r*rjrks   rrmz$ProfileSimulatorTestCase.test_simplernrcTd}t|}|j|dd|fdd|fgy)Ncddzyrqrrgs rriz8ProfileSimulatorTestCase.test_basic_exception.<locals>.f%rrrr4r)r*rjrks   rtest_basic_exceptionz-ProfileSimulatorTestCase.test_basic_exception$rtrcTd}t|}|j|dd|fdd|fgy)Ncddzy#YyxYwrqrrgs rriz9ProfileSimulatorTestCase.test_caught_exception.<locals>.f-rwrxr4r)r*rjrks   rryz.ProfileSimulatorTestCase.test_caught_exception,rzrc	
dfdfd		fd

fd}t}t}t	}t
}t|}|j|dd|fdd|fd	d|fd
d|fdd|fdd|fd
d|fd	d|fdd|fdd|fg
y)
Ncddzyrqrrrrriz:ProfileSimulatorTestCase.test_distant_exception.<locals>.f6rrrcyrrrsrrz:ProfileSimulatorTestCase.test_distant_exception.<locals>.g8rrcyrrrsrrz:ProfileSimulatorTestCase.test_distant_exception.<locals>.h:rrcyrrrsrrz:ProfileSimulatorTestCase.test_distant_exception.<locals>.i<rrcyrrrs rrz:ProfileSimulatorTestCase.test_distant_exception.<locals>.j>rrr4r)r>rrrr*rjrs       @@@@rrz/ProfileSimulatorTestCase.test_distant_exception5rrc^ifd}t|}|j|dd|fdd|fgy)Nc4tjidfiyN*dictgetrhkwargss rriz7ProfileSimulatorTestCase.test_unbound_method.<locals>.fTsHHR&v&rr4r)r*rjrrirlrs   @rtest_unbound_methodz,ProfileSimulatorTestCase.test_unbound_methodRs>	'(!q&'2 (G46	7rcTd}t|}|j|dd|fdd|fgy)Nc,tjyrrrgs rriz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.f\sHHJrr4r)r*rjrks   rtest_unbound_method_no_argsz4ProfileSimulatorTestCase.test_unbound_method_no_args[s8	(!q&'2 (G46	7rcTd}t|}|j|dd|fdd|fgy)Nc8tjtdyrrrprintrgs rrizDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.fdsHHUBrr4r)r*rjrks   r test_unbound_method_invalid_argsz9ProfileSimulatorTestCase.test_unbound_method_invalid_argscs8	 (!q&'2 (G46	7rc^ifd}t|}|j|dd|fdd|fgy)Nc0tjdiy)Nrrrs rrizGProfileSimulatorTestCase.test_unbound_method_no_keyword_args.<locals>.fmsHHvrr4r)r*rjrs   @r#test_unbound_method_no_keyword_argsz<ProfileSimulatorTestCase.test_unbound_method_no_keyword_argsks>	(!q&'2 (G46	7rc^ifd}t|}|j|dd|fdd|fgy)Nc<tjtdfiyrrrs rrizLProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args.<locals>.fvsHHUB)&)rr4r)r*rjrs   @r(test_unbound_method_invalid_keyword_argszAProfileSimulatorTestCase.test_unbound_method_invalid_keyword_argsts>	*(!q&'2 (G46	7rN)
rr r!r\rmrryrrrrrrrrrrrs4&!!!!:77777rrc|t|dr
|j}n|j}|j|jfS)Nf_code)hasattrr__code__co_firstlinenoco_name)functioncodes  rr:r:}s5x"  ,,rc"||y#YyxYwrr)rirhs  rprotectrs	
1Ds
cx|
t}tj}tj	t	j
|jt||t	j
d|rtj	|jddS#|rtjwwxYw)Nr4)
r#gc	isenableddisablerr	r2renablerB)r_rhold_gcs   rr[r[syM\\^FJJLqzz"!tIIK<<>!BIIKsAB  B9cBddl}|jt|y)Nr)r]r[)r_r]s  rshow_eventsrsFMM.*+rc$eZdZdZdZdZdZy)
TestEdgeCasesc|jtjtjtjdyr)
addCleanuprr	rr
s rr
zTestEdgeCases.setUps'(89trcd}dGfdd}tj|tj||jtjy)Ncyrrrs rfooz*TestEdgeCases.test_reentrancy.<locals>.foorcyrrrs rbarz*TestEdgeCases.test_reentrancy.<locals>.barrrceZdZdZfdZy)(TestEdgeCases.test_reentrancy.<locals>.Acyrr)rrs  r__call__z1TestEdgeCases.test_reentrancy.<locals>.A.__call__src0tjyrr)rrs r__del__z0TestEdgeCases.test_reentrancy.<locals>.A.__del__ss#rN)rr r!rr	)rsrArs


$rr
)rr	assertEqualr)rrr
rs   @rtest_reentrancyzTestEdgeCases.test_reentrancysJ			$	$	qss)3/rcd}tj|~tjtjy)Ncyrrrs rrz+TestEdgeCases.test_same_object.<locals>.foorr)rr	r)rrs  rtest_same_objectzTestEdgeCases.test_same_objects+		ss~~'(rcd}dtj_tj}tjd|tj|tj
d|y)Ncyrrrrrriz9TestEdgeCases.test_profile_after_trace_opcodes.<locals>.frrTcyrrrs r<lambda>z@TestEdgeCases.test_profile_after_trace_opcodes.<locals>.<lambda>rcyrrrs rrz@TestEdgeCases.test_profile_after_trace_opcodes.<locals>.<lambda>rr)rr5f_trace_opcodesgettracesettracer	)rri
prev_traces   r test_profile_after_trace_opcodesz.TestEdgeCases.test_profile_after_trace_opcodessR	+/

'\\^
'(	Z )*	rN)rr r!r
rrrrrrrrs0$)
rr__main__r)rr]runittestTestCaserr#rDrYrcrr:r
protect_identr[rrrmainrrr<module>r s	

,X&&,"KK@ 
{ 
FL8$$Lr!,r!jb7|b7J-g
 ",
*H%%*ZzHMMOr