
    Yhk                     p    S SK r S SKrS SKrSSKJr  SSKJr  \R                  (       d   e " S S\5      rg)    N   )TestCase)fails_leakcheckc                   6    \ rS rSrS rS rS r\S 5       rSr	g)GCTests   c                    [         R                  " [        R                  " [        R                  5      R	                  5       5      n[
        R                  " 5         U" 5       b$  SS Kn[        SUR                  U" 5       5      5        U R                  U" 5       5        U R                  [
        R                  [
        R                  5        g )Nr   zO IS NOT NONE.)weakrefrefgreenlet
getcurrentswitchgccollectsysprintgetrefcountassertIsNoneassertFalsegarbage)selfor   s      H/var/www/html/env/lib/python3.13/site-packages/greenlet/tests/test_gc.pytest_dead_circular_refGCTests.test_dead_circular_ref   s{    KK))(*=*=>EEGH


3?"COOAC$89!#RZZ0    c                 .    " S S[         R                   5      nU" 5       nX"l        [        R                  " U5      n[        R
                  " 5         U R                  U" 5       5        U R                  [        R                  [        R                  5        g )Nc                       \ rS rSrSrSrg)9GCTests.test_circular_greenlet.<locals>.circular_greenlet   N )__name__
__module____qualname____firstlineno__r   __static_attributes__r!   r   r   circular_greenletr      s    Dr   r'   )	r   r   r
   r   r   r   r   r   r   )r   r'   r   s      r   test_circular_greenletGCTests.test_circular_greenlet   s_    	 1 1 	KKN


!#RZZ0r   c                 "    " S S[         R                   5      nU" 5       n[        R                  " U5      n[        R                  " 5         U R                  U" 5       5        U R                  [        R                  [        R                  5        g )Nc                        \ rS rSrS rS rSrg)4GCTests.test_inactive_ref.<locals>.inactive_greenlet#   c                 R    [         R                   R                  X R                  S9  g )N)run)r   __init__r/   r   s    r   r0   =GCTests.test_inactive_ref.<locals>.inactive_greenlet.__init__$   s    !!**4XX*>r   c                     g Nr!   r1   s    r   r/   8GCTests.test_inactive_ref.<locals>.inactive_greenlet.run'       r   r!   N)r"   r#   r$   r%   r0   r/   r&   r!   r   r   inactive_greenletr,   #   s    ?r   r7   )r   r
   r   r   r   r   r   r   )r   r7   r   s      r   test_inactive_refGCTests.test_inactive_ref"   s\    	 1 1 	 KKN


!#RZZ0r   c                 4  ^^  " S S[         5      m/ n[        R                  " 5       mUU4S jn[        R                  " U5      nXl        UR	                  U5        UR                  5         AA[        R                  " 5         [        R                  " 5         g )Nc                       \ rS rSrS rSrg);GCTests.test_finalizer_crash.<locals>.object_with_finalizerB   c                     g r4   r!   r1   s    r   __del__CGCTests.test_finalizer_crash.<locals>.object_with_finalizer.__del__C   r6   r   r!   N)r"   r#   r$   r%   r?   r&   r!   r   r   object_with_finalizerr<   B   s    r   rA   c                    > T " 5       [         R                  " 5       l         TR                  5         [         R                  " 5       ?g ! [         R                   a    [        S5         N7f = f! [         R                  " 5       ?f = f)NzGot greenlet exit!)r   r   objectr   GreenletExitr   )rA   parents   r   greenlet_body3GCTests.test_finalizer_crash.<locals>.greenlet_bodyG   sh    +@+BH!(1 '')0 (( ,*+, '')0s#   A A*'A- )A**A- -B)rC   r   r   arrayappendr   r   r   )r   rH   rF   grA   rE   s       @@r   test_finalizer_crashGCTests.test_finalizer_crash/   so    &	F 	 $$&	1 m,Q	



r   r!   N)
r"   r#   r$   r%   r   r(   r8   r   rK   r&   r!   r   r   r   r      s%    111 & &r   r   )	r   r
   r    r   	leakcheckr   GREENLET_USE_GCr   r!   r   r   <module>rP      s5    	    &  Hh Hr   