403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.70
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python315/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python315/Lib/test/__pycache__/test_gc.cpython-315.pyc
R
>lqj��c��]PHs]PHs]QHGs]QHGsGsGsGsG	s	G
s
]QH,Gs]QH4GsGsGs]QHDGsGs]QHGsGs]PHXs]PH\s]PH`s]PHds]PHhs]PHls]PHps]PHvs]QHvGs]QHvGs]PH�s!Q
Q\"2s#QQ
\"2s$\QQ\"22s%\OL2OOQP2%cQ\OL2Q*7s(L\)\Q2%(s(QQ\OT2s+QQ\OT2s,QQ\OT2s-QQ\OT2s.Qs/Qs0\1Q6Xc\Od2P!P!\ cPsQ	sPsCKh9h\ cPs!CKh9h)�)�support)�verbose�
refcount_test�cpython_only�requires_subprocess�requires_gil_enabled�Py_GIL_DISABLED)�
import_module)�temp_dir�TESTFN�unlink)�assert_python_ok�make_script)�threading_helper�gc_threshold)�with_tp_del)�
ContainerNoGCc�&�QQ[2oU!)c�(`�\sQs]snQsQsUsP!)�with_tp_del.<locals>.Cc�0�[OQ2g)zrequires _testcapi.with_tp_del)�unittest�SkipTest)�cls�args�kwargss&*,�!C:\Python315\\Lib\test\test_gc.py�__new__�with_tp_del.<locals>.C.__new__s���'�'�(H�I�I��)�__name__�
__module__�__qualname__�__firstlineno__r�__static_attributes__�__classdictcell__��
__classdict__s@r�Crs����
J�
Jrr))�object)rr)s& rrrs��	J��	J��rc�(`�\sQs]/snQsQsUsP!)�C1055820c� �VmVmP!�N��i�loop)�selfr0s&&r�__init__�C1055820.__init__0s�����	rr/�r!r"r#r$r3r%r&r's@rr,r,/s�����rr,c�(`�\sQs]4snQsQsUsP!)�GC_Detectorc�n`�P
RmU1Qko[O[Q2U2RmP!)Fc�:�P	RmP!�T)�gc_happened)�ignoredr2s&�r�it_happened�)GC_Detector.__init__.<locals>.it_happened;s���#�D�r�)r;�weakref�refr,�wr)r2r=sf rr3�GC_Detector.__init__8s(��� ���	$�
�+�+�h�s�m�[�9��r)r;rBr5r's@rr7r74s����:�:rr7c�6`�\sQs]BsnQsQQksQsQsUsP!)�
UncollectableaCreate a reference cycle with multiple __del__ methods.

An object in a reference cycle will never have zero references,
and so must be garbage collected.  If one or more objects in the
cycle have __del__ methods, the gc refuses to guess an order,
and leaves the cycle uncollected.c�B�Ue[UQ5UmP!VmP!)N��partner)rErH)r2rHs&&rr3�Uncollectable.__init__Js���?�(��6�D�L�"�Lrc��P!r.r �r2s&r�
__tp_del__�Uncollectable.__tp_del__Os��rrGr.)	r!r"r#r$�__doc__r3rLr%r&r's@rrErEBs����)�#�

�
rrE�	PY_CFLAGSz-DNDEBUG�gettotalrefcountc�.`�\sQs]]snQsQsQsQsQsQs	Qs
Qs\Q	2s
\Q
2sQsQsQ
s\Q2sQsQsQs\\Q2Q22s\Q2sQs\O82Q2sQsQsQs Qs!Qs"Qs#Qs$\\%2\&ON\(PIQ2Q222s)Q s*Q!s+\&ON\,Q"2Q#2s-Q$s.Q%s/Q&s0Q's1\Q(2Q)2s2Q*s3Q+s4Q,s5Q-s6\&ON\7PIQ.2Q/2s8\Q02s9\Q12s:Q2s;Q3s<Q4s=\&O|\,Q52\&ON\?PIQ62Q722s@\Q(2\&ON\?PIQ62Q822sAQ9sBUsCP!):�GCTestsc��,oUOU2[O2=UO[O2]2P!����append�gc�collect�assertEqual�r2�ls& r�	test_list�GCTests.test_list^s4����	�����
�
�
��
��������q�)rc��-oV]$[O2=UO[O2]2P!rT�rXrYrZ�r2�ds& r�	test_dict�GCTests.test_dictes0�����!��
�
�
��
��������q�)rc��,oU1oUOU2[O2==UO[O2]2P!)�rV)r2r\�ts&  r�
test_tuple�GCTests.test_tuplels>����
�D��	�����
�
�
��
�
��������q�)rc��QQ2oVm[O2=UO[O2]2P!)c��\sQs]wsQsP!)�GCTests.test_class.<locals>.Ar �r!r"r#r$r%r rr�Arlw���rrn��arXrY�assertNotEqual�r2rns& r�
test_class�GCTests.test_classvs3��	�	���
�
�
��
����B�J�J�L�!�,rc��QQ[2o[O2=UO[O2]2P!)c��\sQs]sQsP!)�%GCTests.test_newstyleclass.<locals>.Ar rmr rrrnrxrorrn)r*rXrYrrrss& r�test_newstyleclass�GCTests.test_newstyleclass~s0��	��	�
�
�
��
����B�J�J�L�!�,rc��QQ2oU2oV"m[O2=UO[O2]2P!)c��\sQs]�sQsP!)� GCTests.test_instance.<locals>.Ar rmr rrrnr}�rorrnrp�r2rnrqs&  r�
test_instance�GCTests.test_instance�s:��	�	�
�C����
�
�
��
����B�J�J�L�!�,rc�v�QQ[2oU2oV"m[O2=UO	[O2]2QQ[
2oQQV12oU2oV"m[O2=UO	[O2]2==UO	[O2]2U2Um=UO	[O2]2UO
[O2]2P!)c��\sQs]�sQsP!)�#GCTests.test_newinstance.<locals>.Ar rmr rrrnr��rorrnc��\sQs]�sQsP!)�#GCTests.test_newinstance.<locals>.Br rmr rr�Br��rorr�c��\sQs]�sQsP!)�#GCTests.test_newinstance.<locals>.Cr rmr rrr)r��rorr))r*rqrXrYrr�listrZ)r2rnrqr�r)s&    r�test_newinstance�GCTests.test_newinstance�s���	��	�
�C����
�
�
��
����B�J�J�L�!�,�	��	�	��	�
�C����
�
�
��
����B�J�J�L�!�,�
�q����B�J�J�L�!�,��c���
����B�J�J�L�!�,��������q�)rc��QQ2oU2o[O2=UO[O2]2P!)c�(`�\sQs]�snQsQsUsP!)�GCTests.test_method.<locals>.Ac�*�UOUmP!r.)r3�initrKs&rr3�'GCTests.test_method.<locals>.A.__init__�s
�� �M�M��	r)r�r5r's@rrnr��s����
*�
*rrn)rXrYrrr~s&  r�test_method�GCTests.test_method�s7��	*�	*�
�C��
�
�
��
����B�J�J�L�!�,rc��[QQ22oQQ2oU2oV3m[U2oU2oVUm[O
2==UO
[O
2]2[OFDo[U2U6XfJU;L	UOQ2[OOW2P!)c�(`�\sQs]�snQsQsUsP!)�(GCTests.test_legacy_finalizer.<locals>.Ac��P!r.r rKs&rrL�3GCTests.test_legacy_finalizer.<locals>.A.__tp_del__����$rr �r!r"r#r$rLr%r&r's@rrnr�������&�&rrnc��\sQs]�sQsP!)�(GCTests.test_legacy_finalizer.<locals>.Br rmr rrr�r��rorr��&didn't find obj in garbage (finalizer))
rrq�id�brXrYrr�garbage�fail�remove�r2rnr�rq�id_ar��objs&      r�test_legacy_finalizer�GCTests.test_legacy_finalizer�s���
�	'�	'�
�	'�	�	�
�C�����!�u��
�C����
�
�
��
�
����B�J�J�L�!�,��:�:�C��#�w�$���E���

�I�I�>�?�
�
�
���#�rc���[QQ[22oQQ[2oU2oV3m[U2oU2oVUm[
O2==UO[
O2]2[
OFDo[U2U6XfJU;L	UOQ2[
OOW2P!)c�(`�\sQs]�snQsQsUsP!)�1GCTests.test_legacy_finalizer_newclass.<locals>.Ac��P!r.r rKs&rrL�<GCTests.test_legacy_finalizer_newclass.<locals>.A.__tp_del__�r�rr r�r's@rrnr��r�rrnc��\sQs]�sQsP!)�1GCTests.test_legacy_finalizer_newclass.<locals>.Br rmr rrr�r��rorr�r�)rr*rqr�r�rXrYrrr�r�r�r�s&      r�test_legacy_finalizer_newclass�&GCTests.test_legacy_finalizer_newclass�s���
�	'��	'�
�	'�	��	�
�C�����!�u��
�C����
�
�
��
�
����B�J�J�L�!�,��:�:�C��#�w�$���E���

�I�I�>�?�
�
�
���#�rc��-o[QU2[O2=UO[O2Q2P!)zdef f(): pass
)rf�)�execrXrY�assertInras& r�
test_function�GCTests.test_function�s6��
���
��"�
�
�
��
�	
�
�
�b�j�j�l�F�+rc��Qo[QU2vq#oUOU]2UOUQ2UOU2P!)a$	if 1:

        import gc
        import weakref

        class LateFin:
            __slots__ = ('ref',)

            def __del__(self):

                # 8. Now `latefin`'s finalizer is called. Here we
                #    obtain a reference to `func`, which is currently
                #    undergoing `tp_clear`.
                global func
                func = self.ref()

        class Cyclic(tuple):
            __slots__ = ()

            # 4. The finalizers of all garbage objects are called. In
            #    this case this is only us as `func` doesn't have a
            #    finalizer.
            def __del__(self):

                # 5. Create a weakref to `func` now. In previous
                #    versions of Python, this would avoid having it
                #    cleared by the garbage collector before calling
                #    the finalizers.  Now, weakrefs get cleared after
                #    calling finalizers.
                self[1].ref = weakref.ref(self[0])

                # 6. Drop the global reference to `latefin`. The only
                #    remaining reference is the one we have.
                global latefin
                del latefin

            # 7. Now `func` is `tp_clear`-ed. This drops the last
            #    reference to `Cyclic`, which gets `tp_dealloc`-ed.
            #    This drops the last reference to `latefin`.

        latefin = LateFin()
        def func():
            pass
        cyc = tuple.__new__(Cyclic, (func, latefin))

        # 1. Create a reference cycle of `cyc` and `func`.
        func.__module__ = cyc

        # 2. Make the cycle unreachable, but keep the global reference
        #    to `latefin` so that it isn't detected as garbage. This
        #    way its finalizer will not be called immediately.
        del func, cyc

        # 3. Invoke garbage collection,
        #    which will find `cyc` and `func` as garbage.
        gc.collect()

        # 9. Previously, this would crash because the weakref
        #    created in the finalizer revealed the function after
        #    `tp_clear` was called and `func_qualname`
        #    had been NULL-ed out by func_clear().  Now, we clear
        #    weakrefs to unreachable objects before calling `tp_clear`
        #    but after calling finalizers.
        print(f"{func=}")
        �-cs\A\s*func=None)r
rZ�assertRegex�assertFalse�r2�code�rc�stdout�stderrs&    r�.test_function_tp_clear_leaves_consistent_state�6GCTests.test_function_tp_clear_leaves_consistent_state�sM��@��B.�d�D�9���F�����Q������!7�8����� rc��Qo[QU2vq#oUOU]2UOUO2Q2P!)z�if 1:
        import _datetime
        class C:
            def __del__(self):
                print('__del__ called')
                _datetime.timedelta(days=1)  # crash?

        l = [C()]
        l.append(l)
        r��__del__ called�r
rZ�stripr�s&    r�test_datetime_weakref_cycle�#GCTests.test_datetime_weakref_cycle8sC��	��.�d�D�9���F�����Q���������):�;rc��Qo[O2U2UO[O2]2P!)c�2�[O2oP!r.)�sys�	_getframe)�frames r�f�GCTests.test_frame.<locals>.fNs
���M�M�O�Err`)r2r�s& r�
test_frame�GCTests.test_frameLs+��	$�
�
�
��	���������q�)rc�J�[O2UO[O,2,oUO	U2[U2o[O2o[OU[O*2=[O2[OU2UO[[O2]2[OO2oUO[U2U2P!rT)rXrYrZr�rWr��	get_debug�	set_debug�
DEBUG_SAVEALL�len�pop)r2�L�id_L�debugr�s&    r�test_saveall�GCTests.test_saveallTs���	�
�
��������R�(���	������!�u�������
���U�R�-�-�-�.�
�
�
�
��
���U������R�Z�Z��!�,��j�j�n�n�������C��$�'rc��[O2o[O2[O]2QQ2oU2o=[O2[OUP!)rUc�(`�\sQsQsnQsQsUsP!)�GCTests.test_del.<locals>.A�rc��[U2P!r.��dirrKs&r�__del__�#GCTests.test_del.<locals>.A.__del__s�	���D�	rr �r!r"r#r$r�r%r&r's@rrnr�r�����
�
rrn)rX�
get_threshold�enable�
set_threshold�disable�r2�
thresholdsrnrqs&   r�test_del�GCTests.test_dellsT���%�%�'�
�
�	�	��
�����	�	�
�C��
�
�
�
��
���*�%rc�
�[O2o[O2[O]2QQ[2oU2o=[O
2[OUP!)rUc�(`�\sQsQsnQsQsUsP!)�$GCTests.test_del_newclass.<locals>.A�c��[U2P!r.r�rKs&rr��,GCTests.test_del_newclass.<locals>.A.__del__�r�rr r�r's@rrnr��r�rrn)rXr�r�r�r*r�r�s&   r�test_del_newclass�GCTests.test_del_newclass{sV���%�%�'�
�
�	�	��
�����	��	�
�C��
�
�
�
��
���*�%rzneeds precise allocation countsc�(�[O2[O2vqo,o[O2vqVoUOV#1Q2UOVg1Q2UO	U]2UOVQ2P!)r�rr)rXrY�	get_countrZ�
assertLess�
assertGreater)r2rqr��c�xrb�er�s&       r�test_get_count�GCTests.test_get_count�sr��	�
�
���,�,�.���a����,�,�.���a����!���(����!���(�����1��	
���1� rc��[O2,o[O]2[O2vq#o[O]2[O2vqVo[O]2[O2vq�o
UOV41Q2UOVg1Q2UOV�1Q2P!)r)rUr)rrUr�)rXrYr�rZ)r2r�rqr�r�rbrr��g�hr0s&          r�test_collect_generations� GCTests.test_collect_generations�s���
�
�
��
��
�
�
�1�
��,�,�.���a�
�
�
�1�
��,�,�.���a�
�
�
�1�
��,�,�.���a�	
���!���(����!���(����!���(rc	�Z`�U1QkQ2n[O2]�o[]2FD_o,o[U2FDoUR2,oJ	,o[U2FDoUR2,oJ	-o[U2FDo]U]R2-oJ	Ja	[O2P!)c�4:`�\sQsQsn]sU1QksQsUsP!)�#GCTests.test_trashcan.<locals>.Ouch�c�:�RO]*RmRO]*]6Xc[O2P!P!rT)�nrXrY)r2�Ouchs&�rr��+GCTests.test_trashcan.<locals>.Ouch.__del__�s0������!�����6�6�B�;�!�#��J�J�L�$rr )r!r"r#r$r
r�r%r&)r(rs@�rrr
�s�����A�
!�
!rr)rXr��ranger�)r2�N�countrgr0�u�vrs&      @r�
test_trashcan�GCTests.test_trashcan�s����	!�	!�(	�	�	�����1�X�E��A��1�X�����K����A��1�X�����K����A��1�X����1�d�f�%����	�
�
�rc��```	`
`�]<n]oQnUU1QkQ[2nUU1Qkn
U	U
1Qko[O2o[OQ2,n	,o[U2FD+o[OUQ5oUOU2J-	[OUU	1Qk29^tt^2[OQ	2PPP2[OU2[O2UO[!RO"2[!RO$22P!)%fhKu9h[OS2h9h)
�<c3�~ �Pw�[OQ2P![OQ2h9h3h)z<A generator that releases the GIL when closed or dealloc'ed.g���ư>)�time�sleepr rr�sleeper_gen�2GCTests.test_trashcan_threads.<locals>.sleeper_gen�s%���
%���
�
�8�$���
�
�8�$�s�=�"�=�:�=c�F:`�\sQsQsn,s,sU1QksUU1QksQsUs	P!)�(GCTests.test_trashcan_threads.<locals>.C��c�H:�VQ$ROOP2P!��NNN)�initsrW)r2�alistr)s&&�rr3�1GCTests.test_trashcan_threads.<locals>.C.__init__�s����Q�������t�$rc�d:�ROOP2R2o[U2P!r.)�delsrW�next)r2rr)rs& ��rr��0GCTests.test_trashcan_threads.<locals>.C.__del__�s#������
�
�d�#� �M���Q�rr )
r!r"r#r$r$r(r3r�r%r&)r(r)rs@��rr)r�s�����E��D�
%�
�
rr)c�V:�R,2o[R2FD
oRU,2,oJ	=P!)zmCreate a sufficiently nested container object so that the
trashcan mechanism is invoked when deallocating it.)r)r�r0r)�NESTINGs  ��r�make_nested�2GCTests.test_trashcan_threads.<locals>.make_nested�s,����"��A��7�^����s�V�H��$�rc�,:�R%f
R2JP!)z!Exercise make_nested() in a loop.r )�exitr-s��r�
run_thread�1GCTests.test_trashcan_threads.<locals>.run_thread�s�����
�rg�h㈵��>)�targetc�(:�RO]2!rT�rW)r0s�r�<lambda>�/GCTests.test_trashcan_threads.<locals>.<lambda>s
������Q�r��?)r�r��getswitchintervalr�setswitchintervalr�	threading�ThreadrWr�
start_threadsrrrXrYrZr�r$r()r2�	N_THREADSr1�old_switchinterval�threadsr0rgr)r,r0r-rs&      @@@@@r�test_trashcan_threads�GCTests.test_trashcan_threads�s������	�	%�	�	��	�$	�	�
!�2�2�4���!�!�$�'�		6��D��G��9�%���$�$�J�7�����q�!�&�"�/�/��9O�P�P��
�
�3��Q�
�!�!�"4�5�
�
�
������Q�W�W��s�1�6�6�{�3�Q�P��
�!�!�"4�5�s+�A"E�=E�E�E	�
E	�E�E,c�L�QQ2oU2oU2oV2mV#m[O2[[O2o==UO[O2]2UO[[O2U2P!)c�(`�\sQsQsnQsQsUsP!)�GCTests.test_boom.<locals>.Boom�c��U;[gr.)�attr�AttributeError�r2�
someattributes&&r�__getattr__�+GCTests.test_boom.<locals>.Boom.__getattr__s
���I�$�$rr )r!r"r#r$rLr%r&r's@r�BoomrEs����
%�
%rrN�rHrXrYr�r�rZ)r2rNrqr��
garbagelens&    r�	test_boom�GCTests.test_boomsq��	%�	%�

�F���F������
�
�
������_�
�
�q�	
�������q�)�����R�Z�Z��*�5rc�L�QQ2oU2oU2oV2mV#m[O2[[O2o==UO[O2]2UO[[O2U2P!)c�.`�\sQsQsnQsQsQsUsP!)�!GCTests.test_boom2.<locals>.Boom2�+c��]UmP!�r�r�rKs&rr3�*GCTests.test_boom2.<locals>.Boom2.__init__,s	����rc�h�U9O]*
tmUO]6�cU;[grT)r�rHrIrJs&&rrL�-GCTests.test_boom2.<locals>.Boom2.__getattr__/s%�����!����6�6�A�:��	�$�$rrY)r!r"r#r$r3rLr%r&r's@r�Boom2rU+s����
�
%�
%rr]rO)r2r]rqr�rPs&    r�
test_boom2�GCTests.test_boom2*sq��	%�	%�
�G���G������
�
�
������_�
�
�q�	
�������q�)�����R�Z�Z��*�5rc	��,QNo[OU2oUO2UOV!2[	U2o[OU2oUO2UOV!2]]]]-o,QNo[OU2oUO2UOV%2[O]],]]-Q2oUO2UOU]],[[
]22*2UO[O]QQ2,2P!)rUrqy@)rUr��)rUr�ra�)rrr)rX�
get_referents�sortrZ�tupler�r)r2r%�got�atuple�adict�expecteds&     r�test_get_referents�GCTests.test_get_referentsEs��������u�%�����
�����$��u������v�&�����
�����$��A�q�!��������u�%�����
�����'�����1�v��1�v�y�9�����
�����q�!�f�t�E�!�H�~�5�6�����)�)�!�S�"�5�r�:rc�j�UO[OP22UO[O]22UO[OQ22UO[OQ22UO[OP	22UO[OP
22UO[OQ22UO[OQ22UO[O[Q222UO[O[22UO[O[
22UO[O[22UO[O[
222QQ2oQQ[
2oQQ	2oQ
Q[2oQQ
[
2oUO[O[22UO[OU22UO[OU222UO[OU222UO[O,22UO[O[222UO[OU222UO[OU222UO[OU222P!)Nr8�arqc��\sQsQsQsP!)�*GCTests.test_is_tracked.<locals>.UserClass�or rmr rr�	UserClassroororrqc��\sQsQsQsP!)�(GCTests.test_is_tracked.<locals>.UserInt�rr rmr rr�UserIntrsrrorruc��\sQsQsQsQsP!)�/GCTests.test_is_tracked.<locals>.UserClassSlots�vr �r!r"r#r$�	__slots__r%r rr�UserClassSlotsrwv����Irr{c��\sQsQsQsQsP!)�/GCTests.test_is_tracked.<locals>.UserFloatSlots�zr ryr rr�UserFloatSlotsr~zr|rr�c��\sQsQsQsQsP!)�-GCTests.test_is_tracked.<locals>.UserIntSlots�~r ryr rr�UserIntSlotsr�~r|rr�y�?@)
r�rX�
is_tracked�	bytearray�type�intr*�float�
assertTrue�set)r2rqrur{r�r�s&     r�test_is_tracked�GCTests.test_is_tracked\s:��
	
������t�,�-�������q�)�*�������s�+�,�������z�2�3�������t�,�-�������u�-�.�������t�,�-�������s�+�,�������y���7�8�������t�,�-�������s�+�,�������v�.�/�������v�x�0�1�	�	�	�c�	�	�	�	�U�	�	�3�	�	
����
�
�b�)�*�����
�
�i�0�1�����
�
�i�k�2�3�����
�
�g�i�0�1�����
�
�b�)�*�����
�
�c�e�,�-�����
�
�n�&6�7�8�����
�
�n�&6�7�8�����
�
�l�n�5�6rc�``�UO[O]22,nU1QkQ2oU2oUO[OU22=[O2RO	2oUO[OU22P!)r�c�0:`�\sQsQsnU1QksQsUsP!)�*GCTests.test_is_finalized.<locals>.Lazarus�c�,:�ROU2P!r.r5)r2�storages&�rr��2GCTests.test_is_finalized.<locals>.Lazarus.__del__�s������t�$rr r�)r(r�s@�r�Lazarusr��s����
%�
%rr�)r�rX�is_finalizedrYr�r�)r2r��lazarusr�s&  @r�test_is_finalized�GCTests.test_is_finalized�su����������+�,���	%�	%��)���������1�2��
�
�
���+�+�-���������0�1rc��``�,nUU1Qko[]2Tt,tFDo[U2MJ	ooSTt,tFDo[OVA2MJ	tonPo[O
2UO
[R2]2Po[O
2UO
[R2]2RFDoUOU2J	P!ttohttoh)c�H:�RTt,tFD	p2MJ	toRQ$P!ttohr"r )r<rB�WRs�ouchs& ��r�callback�*GCTests.test_bug1055820b.<locals>.callback�s ���&)�*�c��r�t�c�*�D��G��*s�)	rr,r@rArXrYrZr��assertIsNone)r2r�r0�Csr�r�r�r�s&     @@r�test_bug1055820b�GCTests.test_bug1055820b�s������	+�$)��8�
,�8�a�h�q�k�8��
,�13�4��A�w�{�{�1�'��4����
�
�
������T��A�&���
�
�
������T��A�&��A����a� ���-��4s
�C�!Cc�``�[O2QQ2nQQ2nUU1QkoU2[O2P!)c��\sQsQsQsP!)� GCTests.test_bug21435.<locals>.A�r rmr rrrnr��rorrnc�.`�\sQsQsnQsQsQsUsP!)� GCTests.test_bug21435.<locals>.B��c��VmP!r.rY)r2r�s&&rr3�)GCTests.test_bug21435.<locals>.B.__init__�s���rc��PUmP!r.�rHrKs&rr��(GCTests.test_bug21435.<locals>.B.__del__�s	�� ��	r)rHr�)r!r"r#r$r3r�r%r&r's@rr�r��s����
�
!�
!rr�c�J:�R2oRR22oVmVmP!r.r�)rqr�rnr�s  ��r�do_work�&GCTests.test_bug21435.<locals>.do_work�s�����A��!�#��A��F��Fr)rXrY)r2r�rnr�s& @@r�
test_bug21435�GCTests.test_bug21435�s7���	�
�
��	�	�	!�	!�	�	�	�
�
�
�rzrequires _testcapic�``�]PHnQoUU1QkoUUQ*2oROQU2ROQU2QoUQ*U*oROV52UUQ*2oROQ	U2RO	Q
U79%fQU7U2ROV52UUQ*2oROQ
U2P!)ra�if 1:
            import gc
            import _testcapi
            @_testcapi.with_tp_del
            class X:
                def __init__(self, name):
                    self.name = name
                def __repr__(self):
                    return "<X %%r>" %% self.name
                def __tp_del__(self):
                    pass

            x = X('first')
            x.x = x
            x.y = X('second')
            del x
            gc.set_debug(%s)
        c�f:�RO[OQQU,ROROQ5oUO	2vq#UO
O
2UOO
2ROUO]2ROUQ2U!)z-Wdr��r�r�r)
�Popenr��
executable�PIPE�communicater��closer�rZ�
returncode)r��pr�r�r2�
subprocesss&   ��r�run_command�5GCTests.test_garbage_at_shutdown.<locals>.run_command�s����� � �#�.�.�%��t�!D�!���!���!�(�A��]�]�_�N�F�
�H�H�N�N��
�H�H�N�N�����Q�\�\�1�-����V�S�)��Mr�0s=ResourceWarning: gc: 2 uncollectable objects at shutdown; uses<X 'first'>s$gc: uncollectable <X 0x[0-9A-Fa-f]+>s
?
zgc.DEBUG_UNCOLLECTABLEs8ResourceWarning: gc: 2 uncollectable objects at shutdowns[<X 'first'>, <X 'second'>]s[<X 'second'>, <X 'first'>]zgc.DEBUG_SAVEALLs!uncollectable objects at shutdown)r�r��assertNotIn�assertNotRegexr�r�)r2r�r�r��one_line_re�expected_rer�sf     @r�test_garbage_at_shutdown� GCTests.test_garbage_at_shutdown�s����	���$		��T�C�Z�(���
�
�'�(.�	0������0�=��!�H�,�{�:�����F�0��T�$<�<�=���
�
�"�#)�	+����
+�v�
5�
7�
7�
+�v�
5��	@�	
����-��T�$6�6�7�����=�v�Frc�j�Qo[QU2vq#oUOUO2Q2P!)z�if 1:
            class C:
                def __del__(self):
                    print('__del__ called')
            l = [C()]
            l.append(l)
            r�r�r�)r2r�r��out�errs&    r�test_gc_main_module_at_shutdown�'GCTests.test_gc_main_module_at_shutdowns2����(��d�3�����������&7�8rc���[29^tt^2oQoQU8Q0o[UQU2[QU2vqEoUOUO	2Q2PPP2P!)%fhP!9h)z�if 1:
                class C:
                    def __del__(self):
                        print('__del__ called')
                l = [C()]
                l.append(l)
                zDif 1:
                import sys
                sys.path.insert(0, z0)
                import gctest
                �gctestr�r�)r
rr
rZr�)r2�
script_dir�moduler�r�r�r�s&      r�#test_gc_ordinary_module_at_shutdown�+GCTests.test_gc_ordinary_module_at_shutdowns_��
�Z�Z�:��F�"�	$�D�

�
�H�f�5�+�D�$�7�L�B�S����S�Y�Y�[�*;�<��Z�Z�Z�s�AA$�$A5	�-A5	�%requires GC generations or incrementsc��Qo[QUQ*2vq#UOUQ2UOUQ2UOUQ2UOUQ2[QUQ*2vq#UOQU2P!)	z^if 1:
            import gc
            gc.set_debug(%s)
            gc.collect()
            r�zgc.DEBUG_STATSs gc: collecting generation [0-9]+s4gc: objects in each generation: [0-9]+ [0-9]+ [0-9]+s+gc: objects in permanent generation: [0-9]+s6gc: done, .* unreachable, .* uncollectable, .* elapsedr�selapsed)r
r�r�)r2r��_r�s&   r�test_gc_debug_stats�GCTests.test_gc_debug_stats,s�����
%�T�4�2B�+B�C�	��1�����A�B�����C�	
�	
����?�	
�	
����E�	
�
%�T�4�#�:�6�	��1�����S�)rc�2�QoUO[[2[[QQQ59^tt^2oUO	U2PPP2[[2vq4oUO
UO2Q2P!)%fhKD9h)z�if 1:
            class ClassWithDel:
                def __del__(self):
                    print('__del__ called')
            a = ClassWithDel()
            a.link = a
            raise SystemExit(0)�wzutf-8)�encodingr�)�
addCleanuprr�open�writer
rZr�)r2r��scriptr�r�r�s&     r�test_global_del_SystemExit�"GCTests.test_global_del_SystemExitFsi��#��	
�����'�
�&�#��
0�
0�F��L�L���1�'��/�����������&7�8�1�
0�s�B�B	�B	c�
�[O2oUO[U2]2SFD�oUO	U[
2UO[
U2.Ql2UOUQ*]2UOUQ*]2UOUQ*]2UOUQ*]2UOUQ*]2J�	[O2%c5UO[O2[O2[O2o[O]2[O2oUOU]*Q*U]*Q*]*2UOU]*Q*U]*Q*2UOU]*Q*U]*Q*2UOU]*Q*U]*Q*2UOU]*Q*U]*Q*2UOU]*Q*U]*Q*2QFD�oUOU]*U*U]*U*2UOU]*U*U]*U*2UOU]*U*U]*U*2J�	[O]2S[O2qCUOU]*Q*U]*Q*2UOU]*Q*U]*Q*2UOU]*Q*U]*Q*]*2UOU]*Q*U]*Q*2UOU]*Q*U]*Q*2UOU]*Q*U]*Q*2QFD�oUOU]*U*U]*U*2UOU]*U*U]*U*2UOU]*U*U]*U*2J�	P!)r��	collected�collections�
uncollectable�
candidates�duration>r�r�r�r�r�)r�r�r�)rX�	get_statsrZr��assertIsInstance�dictr��assertGreaterEqual�	isenabledr�r�r�rYr�)r2�stats�st�old�new�stats&     r�test_get_stats�GCTests.test_get_statsTs������������U��Q�'��B��!�!�"�d�+�����B��W�
�
�#�#�B�{�O�Q�7��#�#�B�}�$5�q�9��#�#�B��$7��;��#�#�B�|�$4�a�8��#�#�B�z�N�A�6���<�<�>�>��O�O�B�I�I�&��J�J�L��l�l�n��
�
�
�1�
��l�l�n������Q��
�.��A��}�0E��0I�J�����Q��
�.��A��}�0E�F�����Q��
�.��A��}�0E�F����3�q�6�*�-�s�1�v�j�/A�B�����Q��
�+�S��V�J�-?�@�����Q��
�+�S��V�J�-?�@�@�D��#�#�C��F�4�L�#�a�&��,�?����S��V�D�\�3�q�6�$�<�8����S��V�D�\�3�q�6�$�<�8�A�	�
�
�1�
������S�����Q��
�.��A��}�0E�F�����Q��
�.��A��}�0E�F�����Q��
�.��A��}�0E��0I�J�����Q��
�+�S��V�J�-?�@�����Q��
�+�S��V�J�-?�@����3�q�6�*�-�s�1�v�j�/A�B�@�D����S��V�D�\�3�q�6�$�<�8����S��V�D�\�3�q�6�$�<�8��#�#�C��F�4�L�#�a�&��,�?�Arc���[O2UO[O2]2[O2UO[O2]2P!rX)rX�freezer��get_freeze_count�unfreezerZrKs&r�test_freeze�GCTests.test_freeze�sF��
�	�	�����2�.�.�0�!�4�
���
�����,�,�.��2rc�N`�[O2,nROR2SO[9PIc>U1Qk[O
22D%fJP	2P!	P
2P!U1Qk[O
2222P!)c3�8:�SF �D
oRUIw�	J	P!3hr.r ��.0�elementr\s& �r�	<genexpr>�+GCTests.test_get_objects.<locals>.<genexpr>�s��0@���0@�W�A��L�0@���)rXrYrWr��any�get_objectsr[s&@r�test_get_objects�GCTests.test_get_objects�sb���
�
�
����	����������A����0@�A���	
��	
��A����0@�A�A�	
rzneed generational GCc	�`�[O2,nROR2SO[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222SO
[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222SO
[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222[O]Q5SO
[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222SO[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222SO
[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222[O]Q5SO
[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222SO
[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222SO[9PIc4U1Q	k[O
]Q52D%fJP	L(	P
L$U1Q	k[O
]Q5222[O]Q5SO
[9PIc4U1Q
k[O
]Q52D%fJP	L(	P
L$U1Q
k[O
]Q5222SO
[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222SO[9PIc4U1Qk[O
]Q52D%fJP	L(	P
L$U1Qk[O
]Q5222<[O2P!)
c3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr��7GCTests.test_get_objects_generations.<locals>.<genexpr>����0L���0L�W�A��L�0L�r��
generationc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	rc3�8:�SF �D
oRUIw�	J	P!3hr.r r�s& �rr�r�r	r)rXrYrWr�rrr�r[s&@r�test_get_objects_generations�$GCTests.test_get_objects_generations�sD���
�
�
����	����������M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�	�
�
�a� ������M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�	�
�
�a� ������M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�	�
�
�a� ������M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�	
�����M����!�0L�M����M����!�0L�M�M�	
�
�
�
�
�rc	���[O2UO[[O22[[OPQ522UO[[OQ2UO[[OQ2UO[[OQ2UO[[OQ2P!)Nr
���1gX9��v��?i���)rXrYrZr�r�assertRaises�
ValueError�	TypeErrorrKs&r�test_get_objects_arguments�"GCTests.test_get_objects_arguments�s���
�
�
������R�^�^�-�.��R�^�^�t�<�=�	?�	
���*�b�n�n�d�;����*�b�n�n�e�<����)�R�^�^�S�9����)�R�^�^�U�;rc�z`�QQ2oU1QkQU2n[O2[O2R2oUORO]2=[O2UORO]2UO[RO2]2ROO2UORO]2[O2UORO]2[O2P!)c�(`�\sQsQsnQsQsUsP!)�AGCTests.test_resurrection_only_happens_once_per_object.<locals>.A��c��VmP!r.��merKs&rr3�JGCTests.test_resurrection_only_happens_once_per_object.<locals>.A.__init__�����rr&r5r's@rrnr#������
�
rrnc�8:`�\sQsQsn]s,sU1QksQsUsP!)�GGCTests.test_resurrection_only_happens_once_per_object.<locals>.Lazarus��c�r:�R9O]*
tmROOU2P!rT)�resurrected�resurrected_instancesrW�r2r�s&�rr��OGCTests.test_resurrection_only_happens_once_per_object.<locals>.Lazarus.__del__�s(����#�#�q�(�#��-�-�4�4�T�:rr )	r!r"r#r$r/r0r�r%r&�r(r�s@�rr�r,�s�����K�$&�!�
;�
;rr�)	rXrYr�rZr/r�r0�clearr�)r2rn�lazr�s&  @r�.test_resurrection_only_happens_once_per_object�6GCTests.test_resurrection_only_happens_once_per_object�s����	�	�	;�a�	;�	�
�
��
�
�
���i������,�,�a�0�
�
�
�
������,�,�a�0�����W�:�:�;�Q�?�	�%�%�+�+�-�����,�,�a�0�
�
�
������,�,�a�0�
�	�	�rc�D`�QQ2oU1QkQ2n[O2[O2R2oU2o[U2oV2mV#m==[O2UO
[RO2]2ROO2oUOUQ2UO
[UO2U2[O2[O2P!)c�(`�\sQsQsnQsQsUsP!)�6GCTests.test_resurrection_is_transitive.<locals>.Cargo��c��VmP!r.r&rKs&rr3�?GCTests.test_resurrection_is_transitive.<locals>.Cargo.__init__�r)rr&r5r's@r�Cargor:�r*rr>c�4:`�\sQsQsn,sU1QksQsUsP!)�8GCTests.test_resurrection_is_transitive.<locals>.Lazarus��c�@:�ROOU2P!r.)r0rWr1s&�rr��@GCTests.test_resurrection_is_transitive.<locals>.Lazarus.__del__�s����-�-�4�4�T�:rr )r!r"r#r$r0r�r%r&r3s@�rr�r@�s����$&�!�
;�
;rr��cargo)rXrYr�r�rDr5rZr�r0r��
assertHasAttrr�)r2r>r5rD�cargo_id�instancer�s&     @r�test_resurrection_is_transitive�'GCTests.test_resurrection_is_transitive�s����	�	�	;�	;�	�
�
��
�
�
���i������e�9���	��	�
��
�
�
������W�:�:�;�Q�?��0�0�4�4�6�����8�W�-�����H�N�N�+�X�6�
�
�
��
�	�	�rc�`�]doQQ2oU1QkQU2o,nQo[O2[O2U2vqV[U2FD
oU2J	[O2oU2vq�UO	V�2UO	V�*
U2UO	V�*
]2X�qeU2[O2oU2vq�UO	U]2UO	V�*
]2UO	V�*
]2X�qe[U2FD
oU2J	U2[O2oU2vq�UO	V�2UO	V�*
U2UO	V�*
]2X�qeRO2[O2oU2vq�UO	U]2UO	V�*
]2UO	V�*
]2[O2P!)�dc�(`�\sQsQsnQsQsUsP!)�LGCTests.test_resurrection_does_not_block_cleanup_of_other_objects.<locals>.Aic��VmP!r.r&rKs&rr3�UGCTests.test_resurrection_does_not_block_cleanup_of_other_objects.<locals>.A.__init__r)rr&r5r's@rrnrMr*rrnc�0:`�\sQsQsnU1QksQsUsP!)�LGCTests.test_resurrection_does_not_block_cleanup_of_other_objects.<locals>.Zic�,:�ROU2P!r.r5)r2�zss&�rr��TGCTests.test_resurrection_does_not_block_cleanup_of_other_objects.<locals>.Z.__del__s����	�	�$�rr r�)r(rSs@�r�ZrQs����
 �
 rrUc�`�[O2P*oUQ*UQ*1!)rUr�r�)rXr�)rbs r�getstats�SGCTests.test_resurrection_does_not_block_cleanup_of_other_objects.<locals>.getstatss&������r�"�A��[�>�1�_�#5�5�5r)rXrYr�rrZr4r�)r2rrnrUrW�oldc�oldncr0rgr��ncrSs&          @r�9test_resurrection_does_not_block_cleanup_of_other_objects�AGCTests.test_resurrection_does_not_block_cleanup_of_other_objects
s����

��	�	�	 ��	 ���	6�	�
�
��
�
�
���j����q��A�
�C���J�J�L���
�������������1�%������Q�'��e�	���J�J�L���
�������A�������1�%������Q�'��e��q��A�
�C��	���J�J�L���
�������������1�%������Q�'��e�
���
��J�J�L���
�������A�������1�%������Q�'�
�	�	�rz%requires ContainerNoGC extension typec��[OO2oQQ2oQQ2oU2oVDm[	U22Um[OUO
OU2Um	UO,oUOU2[O2[O2==[O2UO2[O2P!)c� �\sQsQs,QNsQsP!)�+GCTests.test_trash_weakref_clear.<locals>.Airr )rq�y�wzryr rrrnr`rs��(�Irrnc��\sQsQsQsP!)�+GCTests.test_trash_weakref_clear.<locals>.Ziur rmr rrrUrdurorrU)r�mock�Mockrqrrar@rA�valuerbrWrXrYr��assert_not_calledr�)r2r�rnrUrq�wr_cycles&     r�test_trash_weakref_clear� GCTests.test_trash_weakref_clearPs���@�=�=�%�%�'��	)�	)�	�	�
�C�����A�C� ����{�{�1�3�3�9�9�h�/����D�D�6������!�
�
�
��
�
�
��
�x�
�
�
��	�"�"�$�
�	�	�rc�f�]PHo]PHoUOoUOoUO	[
OU22UO[
OU22UO[[
OU22]2[
OU2P!rX)�	_datetime�_socket�
datetime_CAPI�CAPIr�rXr�r�rZr�rc)r2rmrn�untracked_capsule�tracked_capsules&    r�test_get_referents_on_capsule�%GCTests.test_get_referents_on_capsule�s}��	��%�3�3��!�,�,��
	
������'8�9�:�����
�
�o�6�7�����R�-�-�.?�@�A�1�E�
����)rc�``�UnP
nUU1QkQ2oU2oV"m=[O2UOR2P!)Fc�2:`�\sQsQsnUU1QksQsUsP!)�;GCTests.test_get_objects_during_gc.<locals>.GetObjectsOnDeli�c�:�P	n[O2oSFDoROV I2J	RO[OU2,2P!r:)rXrr�rZ�
get_referrers)r2�objsr�r��tests&  ��rr��CGCTests.test_get_objects_during_gc.<locals>.GetObjectsOnDel.__del__�sG��� �	��~�~�'���C��O�O�C�O�4� �� � ��!1�!1�$�!7��<rr r�)r(r�r{s@��r�GetObjectsOnDelrw�s����
=�
=rr})�cyclerXrYr�)r2r}r�r�r{s&  @@r�test_get_objects_during_gc�"GCTests.test_get_objects_during_gc�s@������	�	=�	=�����	��
�
�
�����	�"rc��,QNo[O2U,oUOU2=[O2[O2P!)rU)rUrfr�)rXr�rWrYr�)r2r�ras&  r�test_traverse_frozen_objects�$GCTests.test_traverse_frozen_objects�s9��
��
�	�	��
�C��	�����
�
�
�
��
���
rc�L�[OQ2o[QU2P!)a
        import gc
        import unittest


        class Test(unittest.TestCase):
            def test_something(self):
                gc.freeze()
                gc.collect()
                gc.unfreeze()


        if __name__ == "__main__":
            unittest.main()
        r���textwrap�dedentr
)r2�sources& r�test_deferred_refcount_frozen�%GCTests.test_deferred_refcount_frozen�s#�����"�
��	��v�&rc���Qo[Q[OU22[OQ[OUQ2Q02o[QU2P!)a1
            class BaseNode:
                def __del__(self):
                    BaseNode.next = BaseNode.next.next
                    fail = BaseNode.next.next

            class Node(BaseNode):
                pass

            BaseNode.next = Node()
            BaseNode.next.next = Node()
        r�z)
            def test():
                z    z

            test()
        )r
r�r��indent)r2r��code_inside_functions&  r�7test_do_not_cleanup_type_subclasses_before_finalization�?GCTests.test_do_not_cleanup_type_subclasses_before_finalization�sZ����	��x���t�4�5�'���4�����v�.�/�0	�0� 
��	��3�4rzrequires free-threaded GCzrequires _testinternalcapic��[O2[O2oQo[	U2Tt,tFDp31MJ	oo[O2[O2oUO[OU]*22UOVQ*
U]*6�2P!ttoh)i N)rXrY�_testinternalcapi�get_long_lived_totalrr�r�r�)r2rr
r��tuples�	new_counts&     r�test_tuple_untrack_counts�!GCTests.test_tuple_untrack_counts�s���	�
�
��!�6�6�8���� %�a��)��1�$���)�
�
�
��%�:�:�<�	�������v�a�y�1�2����	�)�Q�!�V�4�5��*s�
Cc���[O2o,oUOU]*[O22=UOU[O22P!rT)r��get_tracked_heap_sizerZ)r2rr\s&  r�test_heap_size�GCTests.test_heap_sizesR��"�7�7�9����������$5�$K�$K�$M�N�
����� 1� G� G� I�Jrr )Dr!r"r#r$r]rcrhrtryrr�r�rr�r�r�r�r�rr�r�r�r�rrrrr�requires_working_threadingrArQr^rjr�r�r�r�rr�skipIf�	_testcapir�r�r�rr�r�r�r�rrrr6rHr\rrjrsrr�r�r��
skipUnlessr�r�r�r%r&r's@rrRrR]s�����*�*�*�-�-�-�*�0-�����2����2	,�G!�R<�(�*��*�(�0
&�
&�*��;�<�!�=��!��)��)�(!�F�0�0�2�84�3�84�t6�06�6;�.-7�^2�$!�.�@���
�_�_�Y�$�&�(<�=�3G�>���3G�j9�=�&�_�_�_�&M�N�*�O�*�29�*@�X3�
��0�1�,�2�,�\<�"�H �DA�F�_�_�]�d�*�<�>�7�>�7�r�*��*� �#��#�.
�'�45�@����*E�F�
�_�_�&�$�.�0L�M�
6�N�G�
6��0�1�
�_�_�&�$�.�0L�M�K�N�2�KrrRc�`�\sQsQsnQsQsQsQsQsQs	Qs
\Q	2s\
2\O\Q
2Q22sQsUsP!)
�GCCallbackTestsic�x�[O2Um[O2[O2Um[O]2[OOUO2[OOUO2,UmP!rX)rXr��enabledr�r�r�r��	callbacksrW�cb1�cb2�othergarbagerKs&r�setUp�GCCallbackTests.setUpsd���|�|�~���
�
�
���\�\�^��
�
���Q��
�����D�H�H�%�
�����D�H�H�%���rc�&�U;[OOUO2[OOUO
2[OUO2UO%c[O2[O2[OFD"o[U[2%fJPUmJ$	[OQU;[O2P!)Nr#)�visitrXr�r�r�r�r�r�r�r�rYr��
isinstancerErHr�)r2r�s& r�tearDown�GCCallbackTests.tearDown s����J�
�����D�H�H�%�
�����D�H�H�%�
���T�Z�Z� ��<�<�<��I�I�K�
�
�
���:�:�C��#�}�-�-�"����
�J�J�q�M���
�
�
�rc���,Um[O2[OQ*,to[OQ$UOOU2,UmP!r")r�rXrYr�r�rW)r2r�s& r�preclean�GCCallbackTests.preclean1sK����
�
�
�
��!#���A��������A����� � ��)���
rc�V�UOO]U[U212P!rT)r�rWr�)r2�phase�infos&&&rr��GCCallbackTests.cb1;s���
�
���1�e�T�$�Z�0�1rc���UOO]U[U212UQ6Xc�[UQ2%c�[O
Tt,tFDo[
U[2%fJUMJ	oo[O
Tt,tFDo[
U[2%cJUMJ	to[O
Q$SFD
oPUmJ	P!P!P!ttohttoh)rf�stop�cleanupr#)	r�rWr��hasattrrXr�r�rErH)r2r�r�r�ucs&&&  rr��GCCallbackTests.cb2>s����
�
���1�e�T�$�Z�0�1��F�?�w�t�Y�7�7��Z�Z�H�Z��:�a��+G�!�!�Z�B�H�(*�
�
�B�
�1�$.�q�-�$@��Q�
�B�B�J�J�q�M��� ��	�� 8�?��H��Bs�C�2C�C �*C c��UO2[O2UOTt,tFDp]*MJ
	ooSTt,tFD
p3]6XfJUMJ	ooSTt,tFD
p3]6XfJUMJ	ooUO	U],]*2UO	U],]*2UOTt,tFDp]*MJ
	ooSTt,tFD
p3Q6XfJUMJ	ooSTt,tFD
p3Q6XfJUMJ	ooUO	UQ,]*2UO	UQ,]*2UOFDfoU]*oUOQU2UOQU2UOQU2UOQU2UOQU2Jh	P!ttohttohttohttohttohttoh)r�startr�rr�r�r�r�)r�rXrYr�rZr�)r2rr
r0�n1�n2r�s&      r�test_collect�GCCallbackTests.test_collectHs����
�
��
�
�
��
 �:�:�&�:�a�q�T�T�:��&��
%��A�1�f�a�a���
%��
%��A�1�f�a�a���
%�����a�S��U�#�����a�S��U�#� �:�:�&�:�a�q�T�T�:��&��
+��A�7�l�a�a���
+��
*��A�6�k�a�a���
*�����g�Y�q�[�)�����f�X�a�Z�(����A��Q�4�D��M�M�,��-��M�M�+�t�,��M�M�/�4�0��M�M�,��-��M�M�*�d�+�
��
'��
%��
%��

'��
+��
*s;�F4�
F9�F9�&
F>�5F>�>G�
G�%G�0
G
�?G
c��UO2[O]2UOFD%oU]*oUO	UQ*]2J'	P!)rfr)r�rXrYr�rZ)r2rr�s&  r�test_collect_generation�'GCCallbackTests.test_collect_generationesB���
�
��
�
�
�1�
����A��Q�4�D����T�,�/��3�rc�x�UO2[2[2[Q2[O2UO
FDNoU]*Q6wcJU]*oUO
UQ*]2UO
UQ*]2JP	UO
[[O2]2[OFDoUOU[2J	P	Um
,Um,[OQ$[O2UO
FDNoU]*Q6wcJU]*oUO
UQ*]2UO
UQ*]2JP	UO
[[O2]2P!)r?r�r�r�r#)r�rEr,rXrYr�rZr�r�r�r�)r2rr�rs&   r�test_collect_garbage�$GCCallbackTests.test_collect_garbagels;���
�
��������
�
�
�
�����A���t�v�~���Q�4�D����T�+�.��2����T�/�2�A�6��	
����R�Z�Z��!�,����A��!�!�!�]�3�������
���
�
�1�
�
�
�
�����A���t�v�~���Q�4�D����T�+�.��2����T�/�2�A�6��	
����R�Z�Z��!�,rzbuilt with -NDEBUGc��UO2[Q2]PH
o[OQ2oUO[OQU,UOUOQ5oUO2vqEUOO2UOO2UOUQ2UOUQ2QoUOUQU*2UOUQ2UOUQ	U*2UOUQ
2UOUQ2P!)�ctypesa�
            from test.support import gc_collect, SuppressCrashReport

            a = [1, 2, 3]
            b = [a, a]
            a.append(b)

            # Avoid coredump when Py_FatalError() calls abort()
            SuppressCrashReport().__enter__()

            # Simulate the refcount of "a" being too low (compared to the
            # references held on it by live data), but keeping it above zero
            # (to avoid deallocating it):
            import ctypes
            ctypes.pythonapi.Py_DecRef(ctypes.py_object(a))
            del a
            del b

            # The garbage collector should now have a fatal error
            # when it reaches the broken object
            gc_collect()
        r�r�s<gc.*\.c:[0-9]+: .*: Assertion "gc_get_refs\(.+\) .*" failed.srefcount is too smalls
[0-9a-fA-Fx]+sobject address  : sobject refcount : 1sobject type     : sobject type name: lists3object repr     : \[1, 2, 3, \[\[...\], \[...\]\]\])r�r	r�r�r�r�r�r�r�r�r�r�r�r�)r2r�r�r�r�r��
address_regexs&      r�test_refcount_errors�$GCCallbackTests.test_refcount_errors�s"��	
�
�
��	�h������ �
��,
���c�n�n�d�D�9�$.�O�O�$.�O�O�
�
5��������	������	����������L�	N�����%�	'�*�
�����"�]�2�	4�����#�	%�����"�]�2�	4�����&�	(�����C�	Er)r�r�r�r�r�)r!r"r#r$r�r�r�r�r�r�r�rr�rrr��BUILD_WITH_NDEBUGr�r%r&r's@rr�r�sm������"�2�!�,�:4�� -�� -�F��
�_�_�&�)�+�5E�+��5Err�c��`�\sQsQsnQsQs\O\Q2Q2s	\
Q]]2\O\Q2Q22s\
Q]]2Q2s\
]2Q	2s
Q
sUsP!)�GCTogglingTestsi�c�2�[O2P!r.)rXr�rKs&rr��GCTogglingTests.setUp�s��
�	�	�rc�2�[O2P!r.)rXr�rKs&rr��GCTogglingTests.tearDown�s��
�
�
�rr�c�`
`�[]2o[O2[]2oVmU;[]2o[
OU2n
,nU
U1Qko[
OV2oP9o9q#,o]o[2o[%c[O2UO%cPgUO%fPU]*
oUQ6�cUOQ2UO[R2]2UO,2JaUO[R2]2RFDo	UOU	P2J	P!)rc� :�R2,RQ$P!r"r )r<�c2wrr�s&��rr��2GCTogglingTests.test_bug1055820c.<locals>.callback�s����v�h�D��Gr�'�'gc didn't happen after 10000 iterations)r,rXrY�
keep_c0_aliver1r@rAr7rr;r�rZr�rW)r2�c0�c1�c2r��c0wr�junkr0�detectorr�r�r�s&         @@r�test_bug1055820c� GCTogglingTests.test_bug1055820c�s���
�a�[��
�
�
��
�a�[�����G�
�a�[���{�{�2�����	��{�{�2�(������R�@��
���=���?�
�J�J�L��'�'�'�'�'��&�&�&�
��F�A��5�y��	�	�C�D����S��Y��*��K�K��O�����T��A�&��A�
���Q��%�rrc�p`	`
�,n
U	U
1QkQ[2oU]2o[O2[]2oV#mU;[]2o[
OU2n	P9o9q4[2o,o]o[%c[O2UO%fPU]*
oUQ6�cUOQ2UO[R
2]2UO,2JaUO[R
2]2R
FDoUOUP2J	P!)c�2:`�\sQsQsnUU1QksQsUsP!)�+GCTogglingTests.test_bug1055820d.<locals>.Di&c� :�R2,RQ$P!r"r )r2r�r�s&��rr��3GCTogglingTests.test_bug1055820d.<locals>.D.__del__'s����6�(��Q�rr r�)r(r�r�s@��r�Dr�&s����
#�
#rr�r�r�)r,rXrY�
keep_d0_aliver1r@rAr7rr;r�rZr�rW)r2r��d0r�r�r�r�r0r�r�r�s&        @@r�test_bug1055820d� GCTogglingTests.test_bug1055820ds�����	#�	#��	#��q�T��
�
�
��
�a�[�����G�
�a�[���{�{�2�������R�<�=����
���?�
�J�J�L��&�&�&�
��F�A��5�y��	�	�C�D����S��Y��*��K�K��O�����T��A�&��A�
���Q��%�rc���,o]o[2oUO%f5U]*
oUQ6�cUOQ2UO,2JF[O
2,o]o[2oUO%f%U]*
oUQ6�cLUO,2J6UO
UQ2[O2P![O2h9h)rr�r�i')r7r;r�rWrXr�rZr��r2r�r0r�s&   r�$test_indirect_calls_with_gc_disabled�4GCTogglingTests.test_indirect_calls_with_gc_disabledgs�����
���=���&�&�&�
��F�A��5�y��	�	�C�D��K�K��O�
	��J�J�L��D��A�"�}�H��*�*�*��Q����u�9�����B�����Q��&��I�I�K��B�I�I�K�s�4C�C�&C�C0c��,o]o[2oUO%f%U]*
oUQ6�cLUO,2J6UOUQ2P!)riP�iQ�)r7r;rWrZr�s&   r�test_threshold_zero�#GCTogglingTests.test_threshold_zero�sM����
���=���&�&�&�
��F�A��5�y���K�K��O�����E�"rr )r!r"r#r$r�r�rr�rr�rr�r�r�r%r&r's@rr�r��s��������_�_�_�&M�N�I&�O�I&�V�$��1��
�_�_�_�&M�N�E&�O��E&�N�$��1�����4�!�_�
#��
#rr�c�.`�\sQsQsnQsQsQsUsP!)�PythonFinalizationTestsi�c�L�[OQ2o[QU2P!)aM
            import ast
            import codecs
            from test import support

            # Small AST tree to keep their AST types alive
            tree = ast.parse("def f(x, y): return 2*x-y")

            # Store the tree somewhere to survive until the last GC collection
            support.late_deletion(tree)
        r�r��r2r�s& r�
test_ast_fini�%PythonFinalizationTests.test_ast_fini�s#�����
 �

��	��t�$rc�L�[OQ2o[QU2P!)z�
            import asyncio
            from contextvars import ContextVar

            context_loop = ContextVar("context_loop", default=None)
            loop = asyncio.new_event_loop()
            context_loop.set(loop)
        r�r�r�s& r�test_warnings_fini�*PythonFinalizationTests.test_warnings_fini�s!����� �
��	��t�$rr )r!r"r#r$r�r�r%r&r's@rr�r��s����%�&%�%rr�c�J�[O2r[O2[O2%cPg[O2r[O[
[O&*2[O2P!r.)	rXr�r�r�r�r�r��
DEBUG_LEAKrYr rr�setUpModuler��sR���l�l�n�G��J�J�L��|�|�~�~����L�L�N�E��L�L��"�-�-��'�(��J�J�Lrc��[O[2[%c[	Q2[O
2[O2%fPg[%f[O2P!P!)zrestoring automatic collection)	rXr�r�r�printr�r�r�r�r rr�tearDownModuler�sH���L�L����w�
�.�/��I�I�K�
�<�<�>�>��>��7�
�
�
��r�__main__)3r�
unittest.mockr{r�test.supportrrrrrr�test.support.import_helperr	�test.support.os_helperr
rr�test.support.script_helperr
rrrrXr��	sysconfigr�r;rr@r�rr�ImportErrorr�r*r,r7rE�get_config_vars�getr�r��TestCaserRr�r�r�r�rr!�mainr rr�<module>rs������+�+�5�;�;�D�7�	�
��������%�'����v��
:�&�:�
�

�F�

�
�

�
����"�"�;��3�3�#�y�'@�'@�'B�;�'O�O��
%�S�*<�=�=��
uK�h���uK�p%sE�h�'�'�sE�lB#�h�'�'�B#�J%�h�/�/�%�D�	��z���M�M�O���_5���I��
�M��������s0�E�.E4�E1�%E1�0E1�4F�:F�F

Youez - 2016 - github.com/yon3zu
LinuXploit