python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_frame.cpython-311.pyc

e?-0ddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
GddejZGddejZGd	d
ejZGddejZed
krejdSdS)N)support)threading_helper)assert_python_okcjeZdZdZddZdZdZdZdZdZ	d	Z
d
ZdZe
jdZd
S)	ClearTestz"
    Tests for frame.clear().
    cddzdSNr)selfxkwargss   C/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_frame.pyinnerzClearTest.inners	!cV	|jdi|n#t$r}|}Yd}~nd}~wwxYw|S)Nr)rZeroDivisionError)r
reexcs    routerzClearTest.outersU	DJ       			CCCCCC	
s

&!&cR|$|j|j}|"dSdS)z2
        Clear all frames in a traceback.
        N)tb_framecleartb_next)r
tbs  rclear_traceback_framesz ClearTest.clear_traceback_framess3nKBnnnnnrcGdd}|}tj|}||}~tj|d|||jtj|d|dS)NceZdZdS)&ClearTest.test_clear_locals.<locals>.CN__name__
__module____qualname__rrrCr 'Drr%c)	weakrefrefrr
gc_collectassertIsNotr
__traceback__assertIsr
r%r(wrrs     rtest_clear_localszClearTest.test_clear_locals&s								
ACC
[^^jj1joo
rrtt$$$##C$5666

dBBDD!!!!!rczGdd}|}||}~|jj}|||jd||jd||jd||jddS)NceZdZdS)7ClearTest.test_clear_does_not_clear_specials.<locals>.CNr!rrrr%r46r&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_specials5s								
ACCjj1joo
&				4(((T***t,,,d+++++rcdfd}|}t||jdS)NFc3PK	dVddS#dwxYw)NT)r)endlyr
srgz)ClearTest.test_clear_generator.<locals>.gDs8


s!%)nextassertFalsegi_framer
assertTrue)r
r>genr=s`  @rtest_clear_generatorzClearTest.test_clear_generatorBs						accS			rc~	ddzn##t$r}|jj}Yd}~nd}~wwxYw|t5|dddn#1swxYwY|t5|jddddS#1swxYwYdSr
rr-rassertRaisesRuntimeErrorrf_back)r
rr9s   rtest_clear_executingzClearTest.test_clear_executingRsE	)
aCCC 	)	)	)(AAAAAA	)


|
,
,		
GGIII															


|
,
,		
HNN																		s4
(#(A&&A*-A*B22B69B6cdfd}|}t|}|dS)NFc3K	ddzn#t$r}|jj}t5|dddn#1swxYwYt5|jdddn#1swxYwY|VYd}~nd}~wwxYwddS#dwxYw)NrrTrF)rr9r=r
s  rr>z3ClearTest.test_clear_executing_generator.<locals>.g`s\

!$


O,&&|44GGIII&&|44%%HNN$$$%%%%%%%%%%%%%%%

srC
C&B;AB;A 	 B;#A 	$B;B'B;'B+	+B;.B+	/B;6C;CCC)r?r@rrB)r
r>rCr9r=s`   @rtest_clear_executing_generatorz(ClearTest.test_clear_executing_generator]sx						accII				rcfdfd}gd}g|d||g|d||dS)Nc~tjd}|j|jjz
dS)Nr)sys	_getframeappendf_linenor5co_firstlineno)r9liness rrecord_linez7ClearTest.test_lineno_with_tracing.<locals>.record_lineus6
a  ALLAH$;;<<<<<rcz|rdtjd_dS)NTr)rPrQf_trace)tracerVs rtestz0ClearTest.test_lineno_with_tracing.<locals>.testysBKMMM
0+/
a  (KMMMKMMMMMr)rrFT)assertEqual)r
rZexpected_linesrUrVs   @@rtest_lineno_with_tracingz"ClearTest.test_lineno_with_tracingts	=	=	=	=	=					#U///T


/////rctj5Gdd}|}tj|}||}~|d|||j|d|ddddS#1swxYwYdS)NceZdZdS))ClearTest.test_clear_refcycles.<locals>.CNr!rrrr%rasrr%r')	r
disable_gcr)r*rr,rr-r.r/s     rtest_clear_refcycleszClearTest.test_clear_refcycless

!
!		&		&







AQB**q*//CT2244(((''(9:::MM$%%%		&		&		&		&		&		&		&		&		&		&		&		&		&		&		&		&		&		&sBB::B>B>N)r)r"r#r$__doc__rrrr1r:rDrJrMr^rcpython_onlyrcrrrrrs
"
"
",,, 			.000(
&&&&&rrc,eZdZdZdZdZdZdZdS)FrameAttrsTestcd}	|nE#t$r8}|j}g}|r#||j|j}|#Yd}~nd}~wwxYw|S)Nc*dd}fd}|S)Nrc dz}ddzd}dSNrr	rztrs  rrz8FrameAttrsTest.make_frames.<locals>.outer.<locals>.innerE!rryrrs  @rrz)FrameAttrsTest.make_frames.<locals>.outer3AA




577Nr)rr-rRrr)r
rrrframess     rmake_frameszFrameAttrsTest.make_framess				 EGGGG 	 	 	 BF
 

bk***Z
 	 
s

A.A

Ac|\}}}|j}||dtj||ddd|j}||ddddS)Nrrrj)rrt)rrp)rwr6assertIsInstancepoptypesFunctionTyper\)r
r9rrouter_localsinner_localss      rtest_localszFrameAttrsTest.test_localss**,,5%~l..w779KLLLQQ'7'7888~QQ'7'788888rc|\}}}||||ji||jidSN)rwrr\r6r
r9rrs    rr1z FrameAttrsTest.test_clear_localssi**,,5%







,,,,,,,,rc|\}}}|j|j||||ji||jidSr)rwr6rr\rs    rtest_locals_clear_localsz'FrameAttrsTest.test_locals_clear_localssw**,,5%









,,,,,,,,rc|\}}}|t5|`ddddS#1swxYwYdSr)rwrGAttributeErrorrS)r
r9_s   rtest_f_lineno_del_segfaultz)FrameAttrsTest.test_f_lineno_del_segfaults""$$1a


~
.
.		
																		sAA
AN)r"r#r$rwrr1rrrrrrgrgs_&999------rrgceZdZdZdZdS)ReprTestz 
    Tests for repr(frame).
    cJd}|jj}	||dnE#t$r8}|j}g}|r#||j|j}|#Yd}~nd}~wwxYw|\}}}tj	tt}	|t|d|	|dzfz|t|d|	|dzfz|t|d|	|dzfzdS)	Nc*dd}fd}|S)Nrrjc dz}ddzd}dSrlrros  rrz0ReprTest.test_repr.<locals>.outer.<locals>.innerrrrrrss  @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_reprsq			.		,EGGG
II*++++!	 	 	 BF
 

bk***Z
 	 $* Id8nn--	fY%v{34	5	5	5	
gU%vz23	4	4	4	
gU%vz23	4	4	4	4	4s
1
A3.A..A3N)r"r#r$rdrrrrrrs- 4 4 4 4 4rrc~eZdZdZejdZejejdZ	dS)TestIncompleteFrameAreInvisiblec`tjdtd}td|dS)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_issue95818sD     

$	t$$$$$rc|	d}	fdd}tj}tjdd}tj}t	j}	tj|}t|tjtj	dddt	j
|tjd	tjt||
|j	tj	||tjdd<t	j
||rtjdSdS#tj	||tjdd<t	j
||rtjwwxYw)NcdS)z^
            Don't actually do anything, just force a frame object to be created.
            Nr)frameeventargs   rrYzGTestIncompleteFrameAreInvisible.test_sneaky_frame_object.<locals>.tracesrcvtjjtjdS)z
            Yo dawg, I heard you like frames, so I'm allocating a frame while
            you're allocating a frame, so you can have a frame while you have a
            frame!
            N)rPrQrIgc	callbacksremove)phaseinfocallbacksneaky_frame_objects  rrzJTestIncompleteFrameAreInvisible.test_sneaky_frame_object.<locals>.callbacks0#&-//"8L)))))rc3K	dVrrrrrr9zCTestIncompleteFrameAreInvisible.test_sneaky_frame_object.<locals>.fs

rrr)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			
		*		*		*		*		*		*			(**
QQQ
lnnLNN	"	JLLLAGGG
JLLLQ1%%%
LL)))"&IKKKGGG
MM!*&9:::m,,+BLOL###
	


m,,+BLOL###
	
sCE00AF;cRGfddGfddtj}d|}|||0|j|jjj	.dSdS)NceZdZfdZdS)TTestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyDelc.tjdS)a@
                Stash a reference to the entire stack for walking later.

                It may look crazy, but you'd be surprised how common this is
                when using a test runner (like pytest). The typical recipe is:
                ResourceWarning + -Werror + a custom sys.unraisablehook.
                N)rPrQ)r
rs r__del__z\TestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyDel.__del__Os'*moo###rN)r"r#r$r)rsr	SneakyDelrNs.	
6	
6	
6	
6	
6	
6	
6rrceZdZdZfdZdS)WTestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyThreadz
            A separate thread isn't needed to make this code crash, but it does
            make crashes more consistent, since it means sneaky_frame_object is
            backed by freed memory after the thread completes!
            c}dS)z.Run SneakyDel.__del__ as this frame is popped.Nr)r
r*rs  rrunz[TestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardown.<locals>.SneakyThread.runasikkrN)r"r#r$rdr)rsrSneakyThreadrZs8


"
"
"
"
"
"
"rr)
	threadingThreadstartjoinassertIsNotNoner,r5rrrI)r
rrqrrs   @@r!test_sneaky_frame_object_teardownzATestIncompleteFrameAreInvisible.test_sneaky_frame_object_teardownJs
	6
	6
	6
	6
	6
	6
	6
	6
	6
	6		"		"		"		"		"		"		"9+		"		"		"#LNN						
0111!-#*L,<,E


#6"<	"-----rN)
r"r#r$rrrerrrequires_working_threadingrrrrrrsy%%%,
<<<|
0022%=%=32%=%=%=rr__main__)rrrPrrr|unittestr)rZrtest.supportrtest.support.script_helperrTestCaserrgrrr"mainrrr<module>rst								



))))))777777E&E&E&E&E&!E&E&E&P22222X&222j%4%4%4%4%4x %4%4%4N~=~=~=~=~=h&7~=~=~=@zHMOOOOOr