
    fj                         S r SSKrSSKrSSKrSSKr\R
                  " SSS9  S r\R                  " \" 5       5        \R                  " 5         \	" S5        \R                  " S5        g)a  Out-of-process payload for the free-threaded switch/critical-section deadlock.

See ``freethread_switch_deadlock.py`` in the repo root for the full write-up.
Before the fix, a greenlet switch swapped C stacks but left any held
``PyCriticalSection`` locks (tracked in ``tstate->critical_section``) locked.
asyncio's ``Task.__step`` holds such a lock on the running task across the step,
so switching into a child greenlet and touching that task from there blocked
forever. A fixed build (and any GIL-enabled build) prints the sentinel; a
regressed free-threaded build deadlocks, and the watchdog turns that hang into a
non-zero exit so the test fails loudly instead of stalling the whole suite.
    N   T)exitc                     ^#    [         R                  " 5       mU4S jn [        R                  " U 5      R                  5         g 7f)Nc                  N   > T R                  S 5        T R                  S 5        g )Nc                     g N _s    d/var/www/html/GQ-WA/venv/lib/python3.13/site-packages/greenlet/tests/fail_switch_critical_section.py<lambda>.main.<locals>.in_child_fiber.<locals>.<lambda>   s        c                     g r   r	   r
   s    r   r   r      s    Dr   )add_done_callbackremove_done_callback)tasks   r   in_child_fibermain.<locals>.in_child_fiber   s!     	~.!!.1r   )asynciocurrent_taskgreenletswitch)r   r   s    @r   mainr      s2     !D2 n%,,.s   AAzSWITCH CS OK)__doc__r   faulthandlersysr   dump_traceback_laterr   runcancel_dump_traceback_laterprintr   r	   r   r   <module>r"      s^   
   
   ! !"4 0	/ DF   ( ( * n  r   