+
    Xjo                     |    ^ RI t ^ RIt^ RIt^ RIt^RIHt ^RIHt ]P                  '       g   Q h ! R R]4      t	R# )    N)TestCase) fails_leakcheck_on_py314_or_lessc                   N   a  ] tR t^t o R tR tR t]R 4       tR t	R t
RtV tR# )	TestGCc                   \         P                  ! \        P                  ! \        P                  4      P	                  4       4      p\
        P                  ! 4        V! 4       e&   \        R\        P                  ! V! 4       4      4       V P                  V! 4       4       V P                  \
        P                  \
        P                  4       R # )NzO IS NOT NONE.)weakrefrefgreenlet
getcurrentswitchgccollectprintsysgetrefcountassertIsNoneassertFalsegarbage)selfos   & s/Users/jameslopez/projects/FindRefurbishedAppleProduct/.venv/lib/python3.14/site-packages/greenlet/tests/test_gc.pytest_dead_circular_refTestGC.test_dead_circular_ref   sx    KK))(*=*=>EEGH


3?"COOAC$89!#RZZ0    c                0    ! R  R\         P                   4      pV! 4       pW"n        \        P                  ! V4      p\        P
                  ! 4        V P                  V! 4       4       V P                  \        P                  \        P                  4       R# )c                       ] tR t^tRtRtR# )8TestGC.test_circular_greenlet.<locals>.circular_greenletN )__name__
__module____qualname____firstlineno__r   __static_attributes__r   r   r   circular_greenletr      s    Dr   r$   N)	r
   r   r   r	   r   r   r   r   r   )r   r$   r   s   &  r   test_circular_greenletTestGC.test_circular_greenlet   s_    	 1 1 	KKN


!#RZZ0r   c                $    ! R  R\         P                   4      pV! 4       p\        P                  ! V4      p\        P                  ! 4        V P                  V! 4       4       V P                  \        P                  \        P                  4       R# )c                   ,   a  ] tR t^"t o R tR tRtV tR# )3TestGC.test_inactive_ref.<locals>.inactive_greenletc                Z    \         P                   P                  W P                  R 7       R# ))runN)r
   __init__r+   r   s   &r   r,   <TestGC.test_inactive_ref.<locals>.inactive_greenlet.__init__#   s    !!**4XX*>r   c                    R # Nr   r-   s   &r   r+   7TestGC.test_inactive_ref.<locals>.inactive_greenlet.run&       r   r   N)r   r    r!   r"   r,   r+   r#   __classdictcell____classdict__s   @r   inactive_greenletr)   "   s     ? r   r6   N)r
   r   r	   r   r   r   r   r   )r   r6   r   s   &  r   test_inactive_refTestGC.test_inactive_ref!   s\    	 1 1 	 KKN


!#RZZ0r   c                6  aa  ! R  R\         4      o. p\        P                  ! 4       oVV3R lp\        P                  ! V4      pWn        VP	                  V4       VP                  4        ??\        P                  ! 4        \        P                  ! 4        R# )c                   &   a  ] tR t^At o R tRtV tR# ):TestGC.test_finalizer_crash.<locals>.object_with_finalizerc                    R # r0   r   r-   s   &r   __del__BTestGC.test_finalizer_crash.<locals>.object_with_finalizer.__del__B   r2   r   r   N)r   r    r!   r"   r=   r#   r3   r4   s   @r   object_with_finalizerr;   A   s      r   r?   c                    < S ! 4       \         P                  ! 4       n         SP                  4        \         P                  ! 4       =R#   \         P                   d    \        R 4        L9i ; i  \         P                  ! 4       =i ; i)zGot greenlet exit!N)r
   r   objectr   GreenletExitr   )r?   parents   r   greenlet_body2TestGC.test_finalizer_crash.<locals>.greenlet_bodyF   sh    +@+BH!(1 '')0 (( ,*+, '')0s#   A	 	 A,)A/ +A,,A/ /BN)rA   r
   r   arrayappendr   r   r   )r   rF   rD   gr?   rC   s   &   @@r   test_finalizer_crashTestGC.test_finalizer_crash.   so    &	F 	 $$&	1 m,Q	



r   c                    \         P                  R8  d   V P                  R4       ^ RIpR pVP	                  V\        4       4       R# )   Test is 3.15+ onlyNc                     R# )z
>>> import gc
>>> from greenlet import getcurrent, greenlet, GreenletExit
>>> def outer():
...     gc.collect()
>>> outer_glet = greenlet(outer)
>>> outer_glet.switch()
Nr   r   r   r   with_doctest:TestGC.test_crashing_deferred_object.<locals>.with_doctest[       r   rL      r   version_infoskipTestdoctestrun_docstring_examplesdictr   rW   rO   s   &  r   test_crashing_deferred_object$TestGC.test_crashing_deferred_objectW   s9    g%MM./	 	&&|TV<r   c                    \         P                  R8  d   V P                  R4       ^ RIpR pVP	                  V\        4       4       R# )rL   rM   Nc                     R# )a  
>>> import gc
>>> from greenlet import getcurrent, greenlet
>>> class Cycle:
...     def __del__(self):
...         print("(Running finalizer)")
>>> def collect_it():
...     print("Collecting garbage")
...     gc.collect()
>>> def inner():
...     cycle1 = Cycle()
...     cycle2 = Cycle()
...     cycle1.cycle = cycle2
...     cycle2.cycle = cycle1
...     getcurrent().parent.switch()
>>> def outer():
...     glet = greenlet(inner)
...     glet.switch()
...     collect_it()

>>> outer_glet = greenlet(outer)
>>> outer_glet.switch()
Collecting garbage
>>> outer_glet.dead
True
>>> collect_it()
Collecting garbage
(Running finalizer)
(Running finalizer)
Nr   r   r   r   rO   :TestGC.test_cycle_in_suspended_frame.<locals>.with_doctestj   rQ   r   rR   rT   rZ   s   &  r   test_cycle_in_suspended_frame$TestGC.test_cycle_in_suspended_framef   s9    g%MM./	> 	&&|TV<r   r   N)r   r    r!   r"   r   r%   r7   r   rI   r[   r`   r#   r3   r4   s   @r   r   r      s8     111 && &&P=#= #=r   r   )
r   r   r   r
    r   	leakcheckr   GREENLET_USE_GCr   r   r   r   <module>re      s;    	  
   7  {=X {=r   