+
    ÃìÜj   ã                   ó*  € R t ^ RIt^ RIt^ RIt^ RIt^ RIt]! ]P                  P                  RR4      4      t	]
! ]P                  P                  RR4      4      tR t ! R R4      tR	 tR
 tR t]R8X  d   ]! 4        ]P$                  ! ^ 4       R# R# )aT  Reproducer for the free-threaded GC crash in issue #515.

https://github.com/python-greenlet/greenlet/issues/515

Before the fix, ``set_initial_state`` copied the parent thread state's
``_PyCStackRef`` list head into each new greenlet. Those nodes sit on the
parent greenlet's C stack, so once the child starts running on its own stack
and overwrites that region their ``next`` pointers dangle. The free-threaded
collector walks ``c_stack_refs`` for every thread, so a GC on any thread ends
up chasing those dangling nodes (inside ``gc_collect_main`` ->
``gc_visit_thread_stacks``) while such a child is active, and segfaults.

The fiddly part is getting a *non-empty* list to inherit at all. The
interpreter only holds a ``_PyCStackRef`` transiently, while it is resolving an
attribute -- ``_Py_LoadAttr_StackRefSteal`` pins ``self`` across ``obj.attr()``
-- so the greenlet has to be primed from inside that window. Priming it from a
property getter does exactly that; it is also the same deep-attribute context
Playwright's sync bridge happens to start its fiber from. A churn thread then
keeps the collector busy while the dispatcher runs on its stale list.

A fixed build prints "ISSUE 515 OK"; a regressed one segfaults in about a
second. With-GIL builds are unaffected -- ordinary refcounting keeps the nodes
alive -- so there it simply prints the OK line.
NÚREPRO_SECONDSÚ4ÚREPRO_THREADSÚ6c                  óv   € R P                  4       P                  4       P                  4       P                  4       # )Úabc)ÚupperÚlowerÚstripÚtitle© ó    Úi/opt/render/project/src/.venv/lib/python3.14/site-packages/greenlet/tests/fail_issue_515_freethread_gc.pyÚ_busyr   &   s+   € ð �;‰;‹=×ÑÓ ×&Ñ&Ó(×.Ñ.Ó0Ð0r   c                   óH   a € ] tR t^,t o R tR t]R 4       tR tR t	Rt
V tR# )ÚBridgec                ó�   € Wn         \        P                  ! 4       V n        \        P                  ! V P                  4      V n        R # ©N)ÚstopÚgreenletÚ
getcurrentÚmainÚ_loopÚdisp)Úselfr   s   &&r   Ú__init__ÚBridge.__init__-   s-   € ØŒ	Ü×'Ò'Ó)ˆŒ	Ü×%Ò% d§j¡jÓ1ˆŽ	r   c                ó¨   € V P                   ^ ,          '       g9   \        ^24       F  p\        4        K  	  V P                  P	                  4        KQ  R# ©é    N)r   Úranger   r   Úswitch)r   Ú_s   & r   r   ÚBridge._loop2   s7   € Ø—)‘)˜A—,”,Ü˜2–Y�Ü–ñ à�I‰I×ÑÖñ r   c                ó:   € V P                   P                  4        R # r   ©r   r!   ©r   s   &r   Ú_primeÚBridge._prime8   s   € ð
 	�	‰	×ÑÔÙr   c                ó   € V P                   # r   )r'   r&   s   &r   ÚstartÚBridge.start@   s   € ð
 �{‰{Ðr   c                ó:   € V P                   P                  4        R # r   r%   r&   s   &r   ÚresumeÚBridge.resumeG   s   € Ø�	‰	×ÑÖr   )r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   Úpropertyr'   r*   r-   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r   ,   s2   ø‡ € ò2ò
ð ñó ðò÷ð r   r   c                 ó~   € \        V 4      pVP                  4        V ^ ,          '       g   VP                  4        K!  R# r   )r   r*   r-   )r   Úbridges   & r   Úworkerr9   K   s-   € Ü�D‹\€FØ
‡L�L„Nð �1�gŒgØ�‰Žñ r   c                 óþ   € V ^ ,          '       gi   \        R4       Uu. uF	  pRVRR/NK  	  pp\        W"R,          4       F	  w  r4WCR&   K  	  V^ ,          VR,          R&   ?\        P                  ! 4        Kw  R# u upi )r   iô  ÚiÚnextN:é   NNéÿÿÿÿ)r    ÚzipÚgcÚcollect)r   r;   ÚnodesÚaÚbs   &    r   ÚchurnrE   T   sr   € Ø�1�gŒgô 27°s´Ó<±¨A�#�q˜& $Ó'±ˆÐ<Ü˜ R�yÖ)‰DˆAØˆf‹Iñ *à! !�Hˆˆb�	�&ÑØÜ
�
Š
Žñ ùò =s   �A:c            
      ó°  € R .p \         P                  ! \        V 3RR7      .pT\        \        4       Uu. uF!  p\         P                  ! \
        V 3RR7      NK#  	  up,          pV F  pVP                  4        K  	  \         P                  ! 4       P                  \        4       RV ^ &   V F  pVP                  ^R7       K  	  \        R4       R# u upi )FT)ÚtargetÚargsÚdaemon)ÚtimeoutzISSUE 515 OKN)Ú	threadingÚThreadrE   r    ÚNWORKERSr9   r*   ÚEventÚwaitÚDURATIONÚjoinÚprint)r   Úthreadsr"   Úts       r   r   r   `   s²   € Øˆ7€DÜ×Ò¤u°D°7À4ÔHÐI€GØÜœxœó*Ù(�Aô × Ò ¬°d°WÀT×JÙ(ñ*õ *€GãˆØ	�‰Ž	ñ ä‡O‚OÓ×Ñœ8Ô$Ø€Dˆ�GÛˆØ	�‰�qˆÖñ ä	ˆ.Öùò*s   µ'CÚ__main__)Ú__doc__r@   ÚosÚsysrK   r   ÚfloatÚenvironÚgetrP   ÚintrM   r   r   r9   rE   r   r/   Úexitr   r   r   Ú<module>r^      sŒ   ðñó0 
Û 	Û 
Û ã ñ �—‘—‘ °Ó5Ó6€Ùˆr�z‰z�~‰~˜o¨sÓ3Ó4€ò1÷ñ ò>ò	òð ˆzÔÙ„FØ‡H‚HˆQ†Kñ r   