python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_sys_setprofile.cpython-312.opt-1.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%($rNc6|tjd}	|jj|}|jj
||t|fy#t$r3t|j}|jj
|YcwxYw)zAdd an event to the log.N)	r	_getframer%index
ValueErrorlenappendr&ident)rr0r/framenos    rr-zHookWatcher.add_event#s~=MM!$E	&kk''.G
	
GUE%L9:		&$++&GKKu%	&sA9BBct|jjttg}d|_|jDcgc]}|d|vs|c}Scc}w)zRemove calls to add_event().N)r:r-__func__r%r&)r
disalloweditems   r
get_eventszHookWatcher.get_events0sIDNN334eElC
!%JQz0IJJJsAAr)rr r!r'r2r-rArrrr#r#s);Krr#cBeZdZdZdZdZdZdZdZeeeeeedZ	y)	ProfileSimulatorcJ||_g|_tj|yr)testcasestackr#r')rrEs  rr'zProfileSimulator.__init__9s 

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

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

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

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

@	BrcyrrrJs  r
trace_passzProfileSimulator.trace_passNsr)r)r+r*c_callc_returnc_exceptionN)
rr r!r'r2rKrNrQrSrHrrrrCrC8s<#
*!B
$!

HrrCceZdZdZy)TestCaseBasect||j}||k7r>|jdtj|dtj|yy)NzExpected events:
z
Received events:
)capture_eventsnew_watcherrPpprintpformat)rcallableexpectedr&s    rcheck_eventszTestCaseBase.check_events\sN$*:*:*<=XII16>>&3IK
LrN)rr r!r`rrrrXrX[sLrrXc`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:r`rrhf_idents   rtest_simplezProfileHookTestCase.test_simpleg8	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)NcddzyNr4rrrfs rrhz-ProfileHookTestCase.test_exception.<locals>.fp	
aCrr4r)r*rirjs   rtest_exceptionz"ProfileHookTestCase.test_exceptiono8	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Ncddzy#YyxYwrprrfs rrhz4ProfileHookTestCase.test_caught_exception.<locals>.fx1Dr4r)r*rirjs   rtest_caught_exceptionz)ProfileHookTestCase.test_caught_exceptionw:	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Ncddzy#YyxYwrprrfs rrhz;ProfileHookTestCase.test_caught_nested_exception.<locals>.frvrwr4r)r*rirjs   rtest_caught_nested_exceptionz0ProfileHookTestCase.test_caught_nested_exceptionryrcTd}t|}|j|dd|fdd|fgy)Ncddzyrprrfs rrhz4ProfileHookTestCase.test_nested_exception.<locals>.frqrr4r)r*rirjs   rtest_nested_exceptionz)ProfileHookTestCase.test_nested_exceptions:	(!q&'2 !(G4	 	!rcdfd}t}t|}|j|dd|fdd|fdd|fdd|fdd|fdd|fgy)Ncddzyrprrfs rrhz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.frqrcF	|y#|Yy#YYyxYwxYwrrrgrhs rgz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.gs#
!
qTs   r4r)r=r*rirrrkg_identrhs    @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)Ncddzyrprrfs rrhz9ProfileHookTestCase.test_exception_propagation.<locals>.frqrcd||jdy#|jdwxYw)Nfalling throughr,rs rrz9ProfileHookTestCase.test_exception_propagation.<locals>.gs%1[[!23Q[[!23s/r4r)r=r*rrirs    @rtest_exception_propagationz.ProfileHookTestCase.test_exception_propagationsh		4((!q&'2 &'2 (G4 "3W= (G4	 	!rcTd}t|}|j|dd|fdd|fgy)Nc&ddzy#ddzYyxYwrprrfs rrhz/ProfileHookTestCase.test_raise_twice.<locals>.fs1AaCsr4r)r*rirjs   rtest_raise_twicez$ProfileHookTestCase.test_raise_twices:	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Ncddzy#xYwrprrfs rrhz1ProfileHookTestCase.test_raise_reraise.<locals>.fs1Es
r4r)r*rirjs   rtest_raise_reraisez&ProfileHookTestCase.test_raise_reraises:	(!q&'2 (G4 	!rcTd}t|}|j|dd|fdd|fgy)Nctr)	Exceptionrfs rrhz)ProfileHookTestCase.test_raise.<locals>.fs
+rr4r)r*rirjs   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)
Ncddzyrprrrrrhz5ProfileHookTestCase.test_distant_exception.<locals>.frqrcyrrrhsrrz5ProfileHookTestCase.test_distant_exception.<locals>.g
Crcyrrrsrhz5ProfileHookTestCase.test_distant_exception.<locals>.hrrcyrrrsriz5ProfileHookTestCase.test_distant_exception.<locals>.irrcyrrrgrs rjz5ProfileHookTestCase.test_distant_exception.<locals>.jrrr4r)r=rr*rirrrkrh_identi_identj_identrhrrrs       @@@@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]}|ywNr=rangers rrhz-ProfileHookTestCase.test_generator.<locals>.f1X

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

rr4r)r=r*rirs    @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]}|ywrrrs rrhz2ProfileHookTestCase.test_stop_iteration.<locals>.frrcD]}yrrrs  rrz2ProfileHookTestCase.test_stop_iteration.<locals>.grrr4r)r=r*rirs    @rtest_stop_iterationz'ProfileHookTestCase.test_stop_iterations		((!q&'2 &'2 (G4 &'2 (G4 &'2 (G4 (G4
 
	!rN)rr r!r[rlrrrxr|rrrrrrrrrrrrrbrbcsH!!!!	!!&
!!!!!8!,!rrbcHeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
Zy)ProfileSimulatorTestCasect|Sr)rCr
s rr[z$ProfileSimulatorTestCase.new_watchers
%%rcTd}t|}|j|dd|fdd|fgy)Ncyrrrfs rrhz/ProfileSimulatorTestCase.test_simple.<locals>.frrr4r)r*rirjs   rrlz$ProfileSimulatorTestCase.test_simplermrcTd}t|}|j|dd|fdd|fgy)Ncddzyrprrfs rrhz8ProfileSimulatorTestCase.test_basic_exception.<locals>.f%rqrr4r)r*rirjs   rtest_basic_exceptionz-ProfileSimulatorTestCase.test_basic_exception$rsrcTd}t|}|j|dd|fdd|fgy)Ncddzy#YyxYwrprrfs rrhz9ProfileSimulatorTestCase.test_caught_exception.<locals>.f-rvrwr4r)r*rirjs   rrxz.ProfileSimulatorTestCase.test_caught_exception,ryrc	
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)
Ncddzyrprrrrrhz:ProfileSimulatorTestCase.test_distant_exception.<locals>.f6rqrcyrrrsr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*rirs       @@@@rrz/ProfileSimulatorTestCase.test_distant_exception5rrc^ifd}t|}|j|dd|fdd|fgy)Nc4tjidfiyN*dictgetrgkwargss rrhz7ProfileSimulatorTestCase.test_unbound_method.<locals>.fTsHHR&v&rr4r)r*rirrhrkrs   @rtest_unbound_methodz,ProfileSimulatorTestCase.test_unbound_methodRs>	'(!q&'2 (G46	7rcTd}t|}|j|dd|fdd|fgy)Nc,tjyrrrfs rrhz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.f\sHHJrr4r)r*rirjs   rtest_unbound_method_no_argsz4ProfileSimulatorTestCase.test_unbound_method_no_args[s8	(!q&'2 (G46	7rcTd}t|}|j|dd|fdd|fgy)Nc8tjtdyrrrprintrfs rrhzDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.fdsHHUBrr4r)r*rirjs   r test_unbound_method_invalid_argsz9ProfileSimulatorTestCase.test_unbound_method_invalid_argscs8	 (!q&'2 (G46	7rc^ifd}t|}|j|dd|fdd|fgy)Nc0tjdiy)Nrrrs rrhzGProfileSimulatorTestCase.test_unbound_method_no_keyword_args.<locals>.fmsHHvrr4r)r*rirs   @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rhzLProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args.<locals>.fvsHHUB)&)rr4r)r*rirs   @r(test_unbound_method_invalid_keyword_argszAProfileSimulatorTestCase.test_unbound_method_invalid_keyword_argsts>	*(!q&'2 (G46	7rN)
rr r!r[rlrrxrrrrrrrrrrrs4&!!!!:77777rrc|t|dr
|j}n|j}|j|jfS)Nf_code)hasattrr__code__co_firstlinenoco_name)functioncodes  rr:r:}s5x"  ,,rc"||y#YyxYwrr)rhrgs  rprotectrs	
1Ds
cx|
t}tj}tj	t	j
|jt||t	j
d|rtj	|jddS#|rtjwwxYw)Nr4)
r#gc	isenableddisablerr	r2renablerA)r^rgold_gcs   rrZrZsyM\\^FJJLqzz"!tIIK<<>!BIIKsAB  B9cBddl}|jt|y)Nr)r\rZ)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rhz9TestEdgeCases.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	)rrh
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#rCrXrbrr:r
protect_identrZrrrmainrrr<module>r s	

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