python (3.12.0)

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

Αe18ddlZddlZddlZddlZddlZddlZddlZddlZddlZ	ddl	Z	ddlmZddl
mZddlmZGddej"ZGddej"ZGd	d
ej"ZGddej"Zej,e	dud
Gddej"Zedk(rej2yy#e
$rdZ	YwxYw)N)support)threading_helper)assert_python_okcjeZdZ	ddZdZdZdZdZdZdZ	dZ
d	Zejd
Zy)
	ClearTestcddzyNr)selfxkwargss   C/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_frame.pyinnerzClearTest.inners		!c^	|jdi|S#t$r
}|}Yd}~|Sd}~wwxYw)Nr)rZeroDivisionError)rreexcs    routerzClearTest.outers;	DJJ  
!	C
	s	,',c^	|*|jj|j}|)yyN)tb_framecleartb_next)rtbs  rclear_traceback_framesz ClearTest.clear_traceback_frames#s.	nKKBnrcXGdd}|}tj|}|j|}~tj|jd||j
|jtj|jd|y)NceZdZy)&ClearTest.test_clear_locals.<locals>.CN__name__
__module____qualname__rrrCr ,rr%c)	weakrefrefrr
gc_collectassertIsNotr
__traceback__assertIsrr%r(wrrs     rtest_clear_localszClearTest.test_clear_locals+s		
C
[[^jj1jo
rt$##C$5$56

dBD!rcxGdd}|}|j|}~|jj}|j|j	|j
d|j	|jd|j	|jd|j	|jdy)NceZdZy)7ClearTest.test_clear_does_not_clear_specials.<locals>.CNr!rrrr%r4;r&rr%r')	rr-rrr,f_codef_locals
f_builtins	f_globals)rr%r(rfs     r"test_clear_does_not_clear_specialsz,ClearTest.test_clear_does_not_clear_specials:s		
Cjj1jo
&&		4(T*t,d+rcdfd}|}t|j|jjj	y)NFc3JK	djdy#dwxYww)NT)r)endlyrsrgz)ClearTest.test_clear_generator.<locals>.gIs"


s## #)nextassertFalsegi_framer
assertTrue)rr>genr=s`  @rtest_clear_generatorzClearTest.test_clear_generatorGsG	cS	rcd	ddz|jt5jddd|jt5jjdddy#t$r }|jj}Yd}~d}~wwxYw#1swYnxYw#1swYyxYwr	rr-rassertRaisesRuntimeErrorrf_back)rrr9s   rtest_clear_executingzClearTest.test_clear_executingWs	)
aC

|
,	
GGI	


|
,	
HHNN			!	)((A	)				s.A.B
B&.	B7BBB#&B/cdfd}|}t|}j|jjy)NFc3K	ddzdy#t$r}|jj}jt5|jdddn#1swYnxYwjt5|jjdddn#1swYnxYw|Yd}~dyd}~wwxYw#dwxYww)Nr
rTrF)rr9r=rs  rr>z3ClearTest.test_clear_executing_generator.<locals>.ges

!%
OO,,&&|4GGI&&|4%HHNN$%%%
slC
C	B<+B7A	B7A$	 B7<B 	B7 B)	%B70B?4C7B<<B??CC)r?r@rrB)rr>rCr9r=s`   @rtest_clear_executing_generatorz(ClearTest.test_clear_executing_generatorbsB	cI		rcfdfd}gd}g|d|j|g|d|j|y)Nctjd}j|j|jj
z
y)Nr
)sys	_getframeappendf_linenor5co_firstlineno)r9liness rrecord_linez7ClearTest.test_lineno_with_tracing.<locals>.record_linezs0

a ALLAHH$;$;;<rch|rdtjd_y)NTr)rPrQf_trace)tracerVs rtestz0ClearTest.test_lineno_with_tracing.<locals>.test~s&M+/

a (MMr)r
FT)assertEqual)rrZexpected_linesrUrVs   @@rtest_lineno_with_tracingz"ClearTest.test_lineno_with_tracingysL	=	#U/T
/rcZtj5Gdd}|}tj|}|j	|}~|jd||j
|j|jd|dddy#1swYyxYw)NceZdZy))ClearTest.test_clear_refcycles.<locals>.CNr!rrrr%rbsrr%r')	r
disable_gcr)r*rr,rr-r.r/s     rtest_clear_refcycleszClearTest.test_clear_refcycless


!		&

AQB**q*/CT24(''(9(9:MM$%		&		&		&sBB!!B*N)r\)r"r#r$rrrr1r:rDrJrMr_rcpython_onlyrdrrrrrsN
", 	.0(
&&rrc*eZdZdZdZdZdZdZy)FrameAttrsTestcd}	|S#t$rE}|j}g}|r*|j|j|j}|r*Yd}~|Sd}~wwxYw)Nc$dd}fd}|S)Nr\cdz}ddzd}yNr
r	rztr
s  rrz8FrameAttrsTest.make_frames.<locals>.outer.<locals>.innerE!rryrr
s  @rrz)FrameAttrsTest.make_frames.<locals>.outerAA
7Nr)rr-rRrr)rrrrframess     rmake_frameszFrameAttrsTest.make_framessa		 G

!	 BF

bkk*ZZ

	 s	A9AAc|j\}}}|j}|j|jdtj
|j
|ddd|j}|j
|dddy)Nrr\rj)r
rt)r
rp)rwr6assertIsInstancepoptypesFunctionTyper])rr9rrouter_localsinner_localss      rtest_localszFrameAttrsTest.test_localsss**,5%~~l..w79K9KLQQ'78~~QQ'78rc|j\}}}|j|j|j|ji|j|jiyr)rwrr]r6rr9rrs    rr1z FrameAttrsTest.test_clear_localssP**,5%



,,rc|j\}}}|j|j|j|j|j|ji|j|jiyr)rwr6rr]rs    rtest_locals_clear_localsz'FrameAttrsTest.test_locals_clear_localss^**,5%





,,rc|j\}}}|jt5|`dddy#1swYyxYwr)rwrGAttributeErrorrS)rr9_s   rtest_f_lineno_del_segfaultz)FrameAttrsTest.test_f_lineno_del_segfaults>""$1a


~
.	
			s6?N)r"r#r$rwrr1rrrrrrgrgs&9--rrgceZdZ	dZy)ReprTestc*d}|jj}	||jd\}}}tjtt}	|jt|d|	|dzfz|jt|d|	|dzfz|jt|d|	|dzfzy#t$rD}|j}g}|r*|j|j|j}|r*Yd}~d}~wwxYw)	Nc$dd}fd}|S)Nr\rjcdz}ddzd}yrlrros  rrz0ReprTest.test_repr.<locals>.outer.<locals>.innerrrrrrss  @rrz!ReprTest.test_repr.<locals>.outerrurzshould have raisedz=^<frame at 0x[0-9a-fA-F]+, file %s, line %d, code test_repr>$z9^<frame at 0x[0-9a-fA-F]+, file %s, line %d, code outer>$ryz9^<frame at 0x[0-9a-fA-F]+, file %s, line %d, code inner>$r\)
__code__rTfailrr-rRrrreescaperepr__file__assertRegex)
rroffsetrrrvf_thisf_outerf_inner	file_reprs
          r	test_reprzReprTest.test_reprs
	..		,G
II*+#) IId8n-	fY%v{34	5	
gU%vz23	4	
gU%vz23	4#!	 BF

bkk*ZZ	 sC	D9D

DN)r"r#r$rrrrrrs 4rrceZdZdZej
dZej
ejdZ	dZ
y)TestIncompleteFrameAreInvisiblecVtjdtd}td|y)Nz
            import gc

            gc.set_threshold(1,1,1)
            class GCHello:
                def __del__(self):
                    print("Destroyed from gc")

            def gen():
                yield

            fd = open(zy)
            l = [fd, GCHello()]
            l.append(l)
            del fd
            del l
            gen()
        z-c)textwrapdedentrr)rcodes  rtest_issue95818z/TestIncompleteFrameAreInvisible.test_issue95818s2$ l#	 
$	t$rc	d}	fdd}tj}tjdd}tj}t	j
}	tj|}t|tjtjdddt	j|tjjd	tjt||j|j	tj||tjddt	j||rtjyy#tj||tjddt	j||rtjwwxYw)Ncyrr)frameeventargs   rrYzGTestIncompleteFrameAreInvisible.test_sneaky_frame_object.<locals>.traces
rc	tjjjtjjyr)rPrQrIgc	callbacksremove)phaseinfocallbacksneaky_frame_objects  rrzJTestIncompleteFrameAreInvisible.test_sneaky_frame_object.<locals>.callbacks4
#&--/"8"8"?"?LL)rc3K	dwrrrrrr9zCTestIncompleteFrameAreInvisible.test_sneaky_frame_object.<locals>.f#ss	r
r)r
get_thresholdr	isenabledrPgettracedisabler?collect
set_thresholdsettracerRenabler.rA)
rrYr9
old_threshold
old_callbacksold_enabled	old_tracer>rrs
        @@rtest_sneaky_frame_objectz8TestIncompleteFrameAreInvisible.test_sneaky_frame_objects=	
		*	((*
Q
llnLLN	"	JJLAG
JJLQ1%
LLLL)"&IIKG
MM!**&9:m,+BLLOLL#		
m,+BLLOLL#		sCE33AGcNGfddGfddtj}d|}|j|j|j	@|jj|jjj?yy)NceZdZfdZy)TTestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyDelc0	tjyrrPrQ)rrs r__del__z\TestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyDel.__del__Ts'*mmo#rN)r"r#r$r)rsr	SneakyDelrSs	
6rrceZdZ	fdZy)WTestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyThreadc	}yrr)rr*rs  rrunz[TestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyThread.runfs
DkrN)r"r#r$r)rsrSneakyThreadr_s


"rr)
	threadingThreadstartjoinassertIsNotNoner,r5rrrI)rrrqrrs   @@r!test_sneaky_frame_object_teardownzATestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardownOs
	6
	6		"9++		"#N				
01!-#**L,<,<,E,E
#6"<"<	"-rc Gddfd}tj5}tj|}|j	|j
jtddd|jy#1swY xYw)NceZdZy)ZTestIncompleteFrameAreInvisible.test_entry_frames_are_invisible_during_teardown.<locals>.CNr!rrrr%rys'rr%cH	}tj|tSr)r)r*exec)r*r%s rr9zZTestIncompleteFrameAreInvisible.test_entry_frames_are_invisible_during_teardown.<locals>.f|s P#C
;;sD))r)	rcatch_unraisable_exceptionoperatorcallr.
unraisableexc_type	TypeErrorassertIsNone)rr9catcherweakr%s    @r/test_entry_frames_are_invisible_during_teardownzOTestIncompleteFrameAreInvisible.test_entry_frames_are_invisible_during_teardownxsu	(	(	*
/
/
1	BW==#DMM',,55yA		B
	
$&!	B	BsABB
N)r"r#r$rrrerrrequires_working_threadingrrrrrrrsV%,
<<|
0002%=3%=N"rrzneed _testcapic0eZdZdZdZdZdZdZdZy)TestCAPIc*tjSrrrs rgetframezTestCAPI.getframes}}rc|j}|j|jtj||j|jtj||j|jtj||j|jtj|yr)rr]r6	_testcapiframe_getlocalsr.r8frame_getglobalsr7frame_getbuiltinsf_lastiframe_getlasti)rrs  rtest_frame_getterszTestCAPI.test_frame_getterss

)B)B5)IJ

eooy'A'A%'HI

e&&	(C(CE(JK	(@(@(GHrctj}d}|jtj|dd|jtj
|dd|j
t5tj|dddd|j
t5tj
|dddd|j
t5tj|dddd|j
t5tj|ddddy#1swYxYw#1swY~xYw#1swYVxYw#1swYyxYw)Nr
r
xrty{)	rPrQr]rframe_getvarframe_getvarstringrG	NameErrorr)r
current_framer
s   rtest_getvarzTestCAPI.test_getvars



//
sCQG55mTJAN


y
)	7""=#6	7


y
)	>((=	>

y
)	8""=$7	8


y
)	7""=#6	7	7	7	7	>	>	8	8	7	7s08D4,E EE4D=E	EE!c#8Ktjywrrrs rgetgenframezTestCAPI.getgenframesmmosc|j}t|}|j|tj|yr)rr?r.rframe_getgenerator)rrCrs   rtest_frame_get_generatorz!TestCAPI.test_frame_get_generators2 S	

c977>?rc	d}tj|jtt	}|j|jy)Ncyrrrrrdummyz,TestCAPI.test_frame_fback_api.<locals>.dummysr)r	frame_newrglobalslocalsrrI)rrrs   rtest_frame_fback_apizTestCAPI.test_frame_fback_apis<	:	##ENNGIvxH%,,'rN)	r"r#r$rrrrrrrrrrrs"I7 @
(rr__main__)rrrrPrrr|unittestr)rImportErrorrZrtest.supportrtest.support.script_helperrTestCaserrgrrskipIfrr"mainrrr<module>r
s		
)7E&!!E&P2X&&2j%4x  %4NR"h&7&7R"hd"$45+(x  +(6+(ZzHMMO]
IsCCC