python (3.12.0)

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

͑e:`	ddlZddlZddlZddlZ	ddlmZ	ddlmZddlm	Z	GddZ
Gd	d
e
ZeGdde
ZeGd
de
Z
GddeZGddeZGddZGddeej"ZGddZGddeeZGddeeZGddeeZGdd eej"ZGd!d"ZGd#d$eeZGd%d&eeZGd'd(eeZGd)d*eej"ZGd+d,eZeGd-d.eZeGd/d0eZeGd1d2eeZ e	jBGd3d4eej"Z"e#d5k(rejHyy#e$rdZYwxYw#e$rdZYwxYw)6N)with_tp_delc$Gddt}|S)NceZdZdZy)with_tp_del.<locals>.Cctd)Nzrequires _testcapi.with_tp_del	TypeErrorclsargskwargss   J/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_finalization.py__new__zwith_tp_del.<locals>.C.__new__s @AAN__name__
__module____qualname__rrrCrs
Brr)objectrrs  rrr
s	B	Br)
without_gccGdd}|S)NceZdZdZy)without_gc.<locals>.Cctd)Nzrequires _testcapi.without_gcrr
s   rrzwithout_gc.<locals>.C.__new__s ?@@rNrrrrrrs
Arrrrs  rrrs	A	Ar)supportcveZdZ	gZgZgZgZdZdZe	dZ
e	ejdZ
dZdZdZy)	NonGCSimpleBaseFrc8|jj|jjtjjtj
|jj|jjyN)	survivorsclearerrorsgcgarbagecollect	del_callstp_del_callsrs r_cleanupzNonGCSimpleBase._cleanup.s]











 rc#K	tj5|jj|jjdt
_	d|jr|jd	dt
_|j	dddy#dt
_|jwxYw#1swYyxYww)NFrT)	r
disable_gcr)r$r*r 	_cleaningr%r,r+s rtestzNonGCSimpleBase.test7s	


!
	MM!""$(-O%
::**Q-'-1)
	
	-1)
	
	s5C
AB>B9B>	C
B;;B>>CC
cyr"rselfs rcheck_sanityzNonGCSimpleBase.check_sanityI	rc		|jsE|jjt||j	|jyy#t$r%}|jj|Yd}~yd}~wwxYwr")r/r)appendidr4side_effect	Exceptionr%r3es  r__del__zNonGCSimpleBase.__del__Nsm		">>%%bh/!!#  ""	"KKq!!	"AA	BA>>Bcyr"rr2s rr9zNonGCSimpleBase.side_effect[r5rN)rrrr#r)r*r%r/	__slots__classmethodr,
contextlibcontextmanagerr0r4r=r9rrrr r sj
IIL
FII!! 
"rr ceZdZdZdZy)
SimpleBasec$t||_yr")r8id_r2s r__init__zSimpleBase.__init__cs
d8rcyr"rr2s rr4zSimpleBase.check_sanityfsrN)rrrrHr4rrrrErEas$rrEceZdZdZy)NonGCrN)rrrr@rrrrKrKjsIrrKceZdZdZdZy)NonGCResurrectorrc<	|jj|yr"r#r7r2s rr9zNonGCResurrector.side_effectr		
d#rN)rrrr@r9rrrrMrMnsI$rrMceZdZy)SimpleNrrrrrrrRrRxrrRceZdZdZy)SimpleResurrectorc<	|jj|yr"rOr2s rr9zSimpleResurrector.side_effect~rPrNrrrr9rrrrVrV|s$rrVc6eZdZdZdZdZdZdZdZdZ	y)	TestBasecZtjdd|_gtjddyr")r&r'old_garbager2s rsetUpzTestBase.setUps::a=

1
rc	|jtjg|`tjy#|`tjwxYwr")assertEqualr&r'r\r(r2s rtearDownzTestBase.tearDowns=	RZZ, JJL JJLs	 9Ach|jttjt|yr")r_sortedrEr)r3idss  rassert_del_callszTestBase.assert_del_callss!
 4 45vc{Crch|jttjt|yr")r_rbrEr*rcs  rassert_tp_del_callszTestBase.assert_tp_del_callss!
 7 78&+Frcv|jtdtjDt|y)Nc32K|]}t|ywr"r8.0xs  r	<genexpr>z,TestBase.assert_survivors.<locals>.<genexpr>sD!1D)r_rbrEr#rcs  rassert_survivorszTestBase.assert_survivorss'Dz/C/CDDfSkRrcv|jtdtjDt|y)Nc32K|]}t|ywr"rjrks  rrnz*TestBase.assert_garbage.<locals>.<genexpr>s:!1:ro)r_rbr&r'rcs  rassert_garbagezTestBase.assert_garbages%:rzz::F3KHrc@tjjyr")rEr#r$r2s rclear_survivorszTestBase.clear_survivorss""$rN)
rrrr]r`rergrprsrurrrrZrZs)DGSI%rrZcbeZdZ	dZdZejdZejdZy)SimpleFinalizationTestctj5t}t|g}t	j
|}~t
j|j||jg|j|dt
j|j||jgdddy#1swYyxYwr")rEr0rRr8weakrefrefr&r(rerpassertIsr3srdwrs    rtest_simplez"SimpleFinalizationTest.test_simples
__
	&Aa5'CQBJJL!!#&!!"%MM"$%JJL!!#&!!"%	&	&	&B0CCctj5t}t|g}t	j
|}~t
j|j||j||j|d|jt
j|j||jgddd|jdy#1swY!xYwr")
rEr0rVr8ryrzr&r(rerpassertIsNotrur{r|s    rtest_simple_resurrectz,SimpleFinalizationTest.test_simple_resurrects
__
	&!#Aa5'CQBJJL!!#&!!#&RT4(  "JJL!!#&!!"%	&	


bdD!	&	&sCC55C>ctj5t}|jt	j
|t
|g}~t	j|j||jgt	j|j||jgdddy#1swYyxYwr")
rEr0rKassertFalser&
is_trackedr8r(rerpr3r}rds   rtest_non_gcz"SimpleFinalizationTest.test_non_gcs
__

	&AR]]1-.a5'CJJL!!#&!!"%JJL!!#&!!"%
	&
	&
	&sB(CCctj5t}|jt	j
|t
|g}~t	j|j||j||jt	j|j|dz|j|dddy#1swYyxYwN)rEr0rMrr&rr8r(rerprurs   rtest_non_gc_resurrectz,SimpleFinalizationTest.test_non_gc_resurrects
__
	' "AR]]1-.a5'CJJL!!#&!!#&  "JJL!!#'*!!#&	'	'	'sB;CC"N)	rrrrrrcpython_onlyrrrrrrwrwsE&" 
&&
''rrwc(eZdZfdZfdZxZS)
SelfCycleBasec0t|||_yr")superrHrzr3	__class__s rrHzSelfCycleBase.__init__s
rc"t|yr")rr4rs rr4zSelfCycleBase.check_sanitys
r)rrrrHr4
__classcell__rs@rrrs  rrceZdZy)SimpleSelfCycleNrSrrrrrrTrrceZdZy)SelfCycleResurrectorNrSrrrrrrTrrceZdZdZy)SuicidalSelfCyclec	d|_yr")rzr2s rr9zSuicidalSelfCycle.side_effects	rNrXrrrrrsrrc eZdZ	dZdZdZy)SelfCycleFinalizationTestctj5t}t|g}t	j
|}~t
j|j||jg|j|dt
j|j||jgdddy#1swYyxYwr")rEr0rr8ryrzr&r(rerpr{r|s    rrz%SelfCycleFinalizationTest.test_simples
__
	&!Aa5'CQBJJL!!#&!!"%MM"$%JJL!!#&!!"%	&	&	&rctj5t}t|g}t	j
|}~t
j|j||j||j|d|jt
j|j||jg|j|ddddy#1swYyxYwr")rEr0rr8ryrzr&r(rerpr{rur|s    rrz/SelfCycleFinalizationTest.test_simple_resurrects
__
	&$&Aa5'CQBJJL!!#&!!#&MM"$%
  "JJL!!#&!!"%MM"$%!	&	&	&sCC55C>ctj5t}t|g}t	j
|}~t
j|j||jg|j|dt
j|j||jg|j|ddddy#1swYyxYwr")rEr0rr8ryrzr&r(rerpr{r|s    rtest_simple_suicidez-SelfCycleFinalizationTest.test_simple_suicide%s__
	&!#Aa5'CQBJJL!!#&!!"%MM"$%JJL!!#&!!"%MM"$%	&	&	&sCC%%C.N)rrrrrrrrrrrs
&&(&rrc$eZdZdZfdZxZS)ChainedBasec.d|_||_||_y)NFsuicidedleftright)r3rs  rchainzChainedBase.chain9s
	
rct||jry|j}|jr	|j}|jryyr")rr4rrr)r3rrrs   rr4zChainedBase.check_sanity>s9
==99D}}JJE~~r)rrrrr4rrs@rrr7s
**rrceZdZy)
SimpleChainedNrSrrrrrOrTrrceZdZy)ChainedResurrectorNrSrrrrrRrTrrceZdZdZy)SuicidalChainedc0	d|_d|_d|_y)NTrr2s rr9zSuicidalChained.side_effectWs	
	
rNrXrrrrrUsrrcPeZdZ	dZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
y)
CycleChainFinalizationTestc|Dcgc]	}|}}tt|D]}||j||dz
|Scc}w)N)rangelenr)r3classesrnodesis     rbuild_chainz&CycleChainFinalizationTest.build_chaingsQ")*3**s5z"	'A!HNN51:&	'+sA
c*t|}tj5|j|}|Dcgc]
}t	|}}|Dcgc]}tj|}}~tj|j||jg|j|Dcgc]	}|c}dg|ztj|j|dddycc}wcc}wcc}w#1swYyxYwr")rrEr0rr8ryrzr&r(rerpr_)r3rNrr}rdwrsr~s        rcheck_non_resurrecting_chainz7CycleChainFinalizationTest.check_non_resurrecting_chainmsL
__

	'$$W-E"'(Q2a5(C(+01a7;;q>1C1JJL!!#&!!"%S1rbd1D6A:>JJL!!#&
	'
	'(1
2
	'
	's5D	C:D	C?*AD	2D
1D	:D		Dct|}tj5|j|}t|}|Dcgc]
}t	|}}|Dcgc]}t|tst	| }}|Dcgc]}tj|}}~tj|j||j||j|Dcgc]	}|c}dg|z|jtj|j||jgdddycc}wcc}wcc}wcc}w#1swYyxYwr")rrEr0rr8
isinstancerVryrzr&r(rerpr_ru)	r3rrrr}rdsurvivor_idsrr~s	         rcheck_resurrecting_chainz3CycleChainFinalizationTest.check_resurrecting_chain{s'L
__
	&$$W-EE
A"'(Q2a5(C(+0UaJqBS4TBqEULU+01a7;;q>1C1JJL!!#&!!,/S1rbd1D6A:>  "JJL!!#&!!"%	&	&)U12	&	&sI!E#EE#E/
E<E#EAE#&E
4AE#E##E,c6|jtgdzyN)rrr2s rtest_homogenousz*CycleChainFinalizationTest.test_homogenouss))=/A*=>rc6|jtgdzyr)rrr2s rtest_homogenous_resurrectz4CycleChainFinalizationTest.test_homogenous_resurrects%%'9&:Q&>?rc6|jtgdzyr)rrr2s rtest_homogenous_suicidalz3CycleChainFinalizationTest.test_homogenous_suicidals))?*;a*?@rc@|jttgdzyrrrrr2s rtest_heterogenous_suicidal_onez9CycleChainFinalizationTest.test_heterogenous_suicidal_ones))?M*JQ*NOrcL|jtgdztgdzzyrrr2s rtest_heterogenous_suicidal_twoz9CycleChainFinalizationTest.test_heterogenous_suicidal_twos'))
!]Oa$77	9rc@|jttgdzyr)rrrr2s rtest_heterogenous_resurrect_onez:CycleChainFinalizationTest.test_heterogenous_resurrect_ones%%'9=&IA&MNrcJ|jtttgdzyrrrrrr2s rtest_heterogenous_resurrect_twoz:CycleChainFinalizationTest.test_heterogenous_resurrect_twos %%
@1D	Frcb|jtgdztgdzztgdzzyrrr2s r!test_heterogenous_resurrect_threez<CycleChainFinalizationTest.test_heterogenous_resurrect_threes6%%
 1$
'::o=NQR=RR	TrN)rrrrrrrrrrrrrrrrrrr`sD'&&?@AP9OFTrrceZdZdZdZy)
LegacyBasec	|js5|jjt||j	yy#t
$r%}|jj|Yd}~yd}~wwxYwr")r/r)r7r8r4r:r%r;s  rr=zLegacyBase.__del__s^	">>%%bh/!!#"	"KKq!!	"sAA	A2
A--A2c		|jsE|jjt||j	|jyy#t$r%}|jj|Yd}~yd}~wwxYwr")r/r*r7r8r4r9r:r%r;s  r
__tp_del__zLegacyBase.__tp_del__so		">>!!((D2!!#  ""	"KKq!!	"r>N)rrrr=rrrrrrs"
"rrceZdZy)LegacyNrSrrrrrrrceZdZdZy)LegacyResurrectorc<	|jj|yr"rOr2s rr9zLegacyResurrector.side_effectrPrNrXrrrrrs$rrceZdZy)LegacySelfCycleNrSrrrrrrrrc2eZdZ	fdZdZdZdZxZS)LegacyFinalizationTestctjjtjt|yr")r&r'r$r(rr`rs rr`zLegacyFinalizationTest.tearDowns)	





rctj5t}t|g}t	j
|}~t
j|j||j||jg|j|dt
j|j||j|dddy#1swYyxYwr")rEr0rr8ryrzr&r(rergrpr{r|s    rtest_legacyz"LegacyFinalizationTest.test_legacys
__
	*Aa5'CQBJJL!!#&$$S)!!"%MM"$%JJL!!#&$$S)	*	*	*sCCC(cLtj5t}t|g}t	j
|}~t
j|j||j||j||j|d|jt
j|j||j|dz|j|ddd|jdy#1swY!xYwr)
rEr0rr8ryrzr&r(rergrpr{rur|s    rtest_legacy_resurrectz,LegacyFinalizationTest.test_legacy_resurrects
__
	'!#Aa5'CQBJJL!!#&$$S)!!#&MM"$%  "JJL!!#&$$S1W-!!#&	' 	


bdD!!	'	'sC%DD#ctj5t}t|g}t	j
|}~t
j|jg|jg|jg|j||j|ddtjd_ddd|jg|jdy#1swY2xYw)Nr)rEr0rr8ryrzr&r(rergrprsrr'r{r|s    rtest_legacy_self_cyclez-LegacyFinalizationTest.test_legacy_self_cycles
__
	%!Aa5'CQBJJL!!"%$$R(!!"%$RT4( $BJJqM	%	
B

bdD!	%	%sB4C::D)rrrr`rrrrrs@rrrs
*"&"rr__main__)%rBr&unittestry	_testcapirImportErrorrr0rr rErKrMrRrVrZTestCaserwrrrrrrrrrrrrrrrrrmainrrr<module>rs	%$??D$$O$$$	Z	$
$%%<>'Xx'8'8>'B  	mV		=*;	
v7&(*;*;7&t**0	K		&7	k6GT8+<+<GTZ""0
	Z	
	
$
$
$
	mZ	
		>"Xx'8'8>">"BzHMMO[s"FF!FF!F-,F-