+
    Bib                        ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIt^ RIHt ^ RIH	t	 ]	P                  ! RR7        ! R R	]4      tR
 t ! R R4      t ! R R]]4      t]P                   ! ]! ] P$                  R4      R4       ! R R]]4      4       t ! R R]4      t]P                   ! ]! ] P$                  R4      R4       ! R R]]4      4       tR# )    N)Thread)TestCase)support)threading_helperT)modulec                       ] tR t^tRtR# )MyException N)__name__
__module____qualname____firstlineno____static_attributes__r
       </usr/lib/python3.14/test/test_asyncio/test_free_threading.pyr	   r	      s    r   r	   c                  D    \         P                  P                  R 4       R # N)asyncioevents_set_event_loop_policyr
   r   r   tearDownModuler      s    NN))$/r   c                   z   a  ] tR t^t o V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltRt	V t
R# )TestFreeThreadingc                   < V ^8  d   QhRR/#    returnNr
   )format__classdict__s   "r   __annotate__TestFreeThreading.__annotate__   s     ' 'T 'r   c                   a a V 3R  loVV 3R lp. p\        ^
4       F   p\        VR7      pVP                  V4       K"  	  \        P                  ! V4      ;_uu_ 4         RRR4       R#   + '       g   i     R# ; i)c            	      J  <a"   \         P                  ! 4       p V P                  4       oV3R  lp\        4       p\         P                  ! 4       ;_uu_4       GRj  xL
 p\        ^d4       F(  pVP                  VP                  V! 4       4      4       K*  	  \         P                  ! V 4      pS	P                  \        V4      ^e4       V FB  pS	P                  VP                  4       V 4       S	P                  VP                  4       4       KD  	  \         P                  ! 4       pS	P                  VP                  4       V 4       S	P                  WRV0,          4       SP!                  R4       RRR4      GRj  xL
  R#  EL& L	  + GRj  xL 
 '       g   i     R# ; i5i)c                  (   <"   S G R j  xL
  R #  L5ir   r
   )futures   r   coroATestFreeThreading.test_all_tasks_race.<locals>.main.<locals>.coro   s     s   N)r   get_running_loopcreate_futureset	TaskGrouprangeaddcreate_task	all_tasksassertEquallenget_loopassertFalsedonecurrent_taskassertSetEqual
set_result)
loopr&   taskstg_r/   taskcurrentr%   selfs
           @r   main3TestFreeThreading.test_all_tasks_race.<locals>.main   s&    ++-D'')F EE((***bsAIIbnnTV45 $ $--d3	  Y5%D$$T]]_d;$$TYY[1 & "..0  !1!1!3T:##Iy/@A!!$' +******sO   AF#FF#DF/F#:F;F#F#F 	F
F 	F 		F#c                     < \         P                  ! 4       ;_uu_ 4       p V P                  4       pVP                  SP                  4       V P                  S! 4       4       R R R 4       R #   + '       g   i     R # ; ir   r   Runnerr2   set_task_factoryfactoryrun)runnerr8   r?   r>   s     r   rG   5TestFreeThreading.test_all_tasks_race.<locals>.runner0   M    !!V(%%dll3

46" "!!!   AA++A<	targetN)r,   r   appendr   start_threads)r>   rG   threadsr;   threadr?   s   f    @r   test_all_tasks_race%TestFreeThreading.test_all_tasks_race   s]    	(2	# rA6*FNN6"  ++G44 5444s   A++A<	c                   < V ^8  d   QhRR/# r   r
   )r   r   s   "r   r    r!   ?   s     " " "r   c                P  a aaaaa	a
a R o\         P                  ! 4       o
\         P                  ! 4       oR o\         P                  ! 4       o\        4       oVVVVV
V3R lo	\         P                  ! V	3R lR7      pVVV V
V3R lp\        ^
4       Uu. uF  p\         P                  ! VR7      NK  	  ppVP                  4        \        P                  ! V4      ;_uu_ 4         R R R 4       SP                  4        VP                  4        R # u upi   + '       g   i     L7; i)Nc                  L   "   \         P                  ! 4       G R j  xL
  R #  L5ir   )r   Futurer
   r   r   r&   ?TestFreeThreading.test_all_tasks_different_thread.<locals>.coroC   s     .."""s   $"$c                  N  <"   \         P                  ! 4       oSP                  4        \        R 4       FG  p S;_uu_ 4        \         P                  ! S! 4       4       \         P
                  ! S4      oRRR4       KI  	  SP                  4        R#   + '       g   i     Kn  ; i5i)i  N)r   r(   r*   r,   r.   r/   wait)ir&   r4   lockr8   startedr9   s    r   r?   ?TestFreeThreading.test_all_tasks_different_thread.<locals>.mainI   sk     ++-DKKM4[T''/#--d3E T ! IIK TTs   >B%2B3B%B"	B%c                  :   < \         P                  ! S ! 4       4      # r   )r   rF   )r?   s   r   <lambda>CTestFreeThreading.test_all_tasks_different_thread.<locals>.<lambda>S   s    TV1Dr   rK   c                     < SP                  4        S ;_uu_ 4        SP                  S\        P                  ! S4      ,          S4       R R R 4       R #   + '       g   i     R # ; ir   )rY   r6   r   r/   )r[   r8   r>   r\   r9   s   r   check@TestFreeThreading.test_all_tasks_different_thread.<locals>.checkU   s=    LLN##EG,=,=d,C$CUK s   .AA%	)
	threadingEventLockr*   r   r,   startr   rN   join)r>   rG   rb   r;   rO   r&   r4   r[   r8   r?   r\   r9   s   f    @@@@@@@r   test_all_tasks_different_thread1TestFreeThreading.test_all_tasks_different_thread?   s    //# 	# ~~	 	 !!)DE	L 	L
 <A9E9a9##519E++G44 5 	
 F 54s    D$DD%	c                   < V ^8  d   QhRR/# r   r
   )r   r   s   "r   r    r!   c   s        d  r   c                  a aa R oV3R loVV 3R lp\        VR7      pVP                  4        VP                  4        \        P                  ! S4      p?>\
        P                  ! 4        S P                  V! 4       4       R # )Nc                  :   <"   \         P                  ! 4       o R # 5ir   )r   r5   )r<   s   r   funcDTestFreeThreading.test_task_different_thread_finalized.<locals>.funce   s     '')Ds   c                     < \         P                  ! 4       ;_uu_ 4       p V P                  4       pVP                  SP                  4       V P                  S! 4       4       R R R 4       R #   + '       g   i     R # ; ir   rB   )rG   r8   rn   r>   s     r   rG   FTestFreeThreading.test_task_different_thread_finalized.<locals>.runnerh   rI   rJ   rK   )r   rg   rh   weakrefrefr   
gc_collectassertIsNone)r>   rG   rP   wrrn   r<   s   f   @@r   $test_task_different_thread_finalized6TestFreeThreading.test_task_different_thread_finalizedc   s`    	*	#
 v&[["$r   c                   < V ^8  d   QhRR/# r   r
   )r   r   s   "r   r    r!   w   s      t r   c                *  a aa . oR  VV 3R lloVVV 3R lp\         P                  ! 4       ;_uu_ 4       pVP                  4       pVP                  S P                  4       VP                  V! 4       4       RRR4       R#   + '       g   i     R# ; i)c                8    V ^8  d   QhR\         P                  /# r   r8   r   AbstractEventLoop)r   s   "r   r    ETestFreeThreading.test_run_coroutine_threadsafe.<locals>.__annotate__z   s     	# 	#G55 	#r   c                    < \         P                  ! R ^*R7      p\         P                  ! W4      pVP                  4       pSP	                  V^*4       SP                  V4       R# )g?)resultN)r   sleeprun_coroutine_threadsafer   r0   rM   )r8   r&   futr   resultsr>   s   &   r   	in_threadBTestFreeThreading.test_run_coroutine_threadsafe.<locals>.in_threadz   sJ    ==R0D224>CZZ\FVR(NN6"r   c            	        <"   \         P                  ! 4       p \         P                  ! 4       ;_uu_4       GR j  xL
 p\        ^
4       F)  pVP	                  \         P
                  ! SV 4      4       K+  	  R R R 4      GR j  xL
  SP                  S^*.^
,          4       R #  Lh L"  + GR j  xL 
 '       g   i     L9; i5ir   )r   r(   r+   r,   r.   	to_threadr0   )r8   r:   r;   r   r   r>   s      r   r?   =TestFreeThreading.test_run_coroutine_threadsafe.<locals>.main   s}     ++-D((***brANN7#4#4Y#EF # +* WrdRi0 +***sJ   7CB#C9B'7CB%!C%C'C 	-B0.
C 	9C 	;CNrB   )r>   r?   rr8   r   r   s   f   @@r   test_run_coroutine_threadsafe/TestFreeThreading.test_run_coroutine_threadsafew   sa    	# 	#	1 ^^::<D!!$,,/EE$&M s   ABB	c                   < V ^8  d   QhRR/# r   r
   )r   r   s   "r   r    r!      s       r   c                (  a aa R  oR V3R lloVV 3R lp\         P                  ! 4       ;_uu_ 4       pVP                  4       pVP                  S P                  4       VP                  V! 4       4       RRR4       R#   + '       g   i     R# ; i)c                  `   "   \         P                  ! ^ 4      G Rj  xL
  \        R4      h L5i)r   Ntest)r   r   r	   r
   r   r   r&   GTestFreeThreading.test_run_coroutine_threadsafe_exception.<locals>.coro   s'     --"""f%% #s   .,.c                8    V ^8  d   QhR\         P                  /# r|   r}   )r   s   "r   r    OTestFreeThreading.test_run_coroutine_threadsafe_exception.<locals>.__annotate__   s     	  	 G55 	 r   c                 \   < \         P                  ! S! 4       V 4      pVP                  4       # r   )r   r   r   )r8   r   r&   s   & r   r   LTestFreeThreading.test_run_coroutine_threadsafe_exception.<locals>.in_thread   s#    22464@C::<r   c                    <"   \         P                  ! 4       p . p\        ^
4       F:  pV P                  \         P                  ! SV 4      4      pVP                  V4       K<  	  \         P                  ! VRR/ G Rj  xL
 pSP                  \        V4      ^
4       V F4  pSP                  V\        4       SP                  \        V4      R4       K6  	  R#  L[5i)
   return_exceptionsTNr   )r   r(   r,   r.   r   rM   gatherr0   r1   assertIsInstancer	   str)r8   r9   r;   r<   r   r   r   r>   s         r   r?   GTestFreeThreading.test_run_coroutine_threadsafe_exception.<locals>.main   s     ++-DE2Y''(9(9)T(JKT"  $NNEJTJJGS\2.!%%fk:  Vf5 " Ks   A:C=C>ACNrB   )r>   r?   r   r8   r&   r   s   f   @@r   'test_run_coroutine_threadsafe_exception9TestFreeThreading.test_run_coroutine_threadsafe_exception   sa    	&	  	 	6 ^^::<D!!$,,/EE$&M s   AB  B	r
   N)r   r   r   r   rQ   ri   rw   r   r   r   __classdictcell__r   s   @r   r   r      s9     ' 'R" "H   ( , r   r   c                   D   a a ] tR t^t oV 3R ltV 3R ltR tRtVtV ;t	# )TestPyFreeThreadingc                  < \         P                  V n        \         P                  P                  ;\         n        \         P                  n        \         P
                  V n        \         P                  P                  ;\         n        \         P                  n        \         P                  V n	        \         P                  P                  ;\         n        \         P                  n        \         P                  V n        \         P                  P                  ;\         n        \         P                  n        \        SV `A  4       # r   )r   r5   _old_current_taskr9   _py_current_taskr/   _old_all_tasks_py_all_tasksTask	_old_Task_PyTaskrV   _old_Futurefutures	_PyFuturesupersetUpr>   	__class__s   &r   r   TestPyFreeThreading.setUp   s    !(!5!5<CMM<Z<ZZw}}9%//6=mm6Q6QQGMM3 ,3MM,A,AAw}})">>29//2K2KK/w}r   c                p  < V P                   ;\        n        \        P                  n        V P                  ;\        n        \        P                  n        V P                  ;\        n        \        P                  n        V P                  ;\        n	        \        P                  n	        \        SV `-  4       # r   )r   r   r5   r9   r   r/   r   r   r   rV   r   tearDownr   s   &r   r   TestPyFreeThreading.tearDown   su    <@<R<RRw}}96:6I6IIGMM3,0NN:w}})040@0@@-w!!r   c                H    \         P                  P                  ! V3R V/VB # r8   r   r9   r   r>   r8   r&   kwargss   &&&,r   rE   TestPyFreeThreading.factory   s!    }}$$T????r   r   r   r   r   
r   r   r   r   r   r   rE   r   r   __classcell__r   r   s   @@r   r   r      s     	"@ @r   r   _c_all_taskszrequires _asyncioc                   D   a a ] tR t^t oV 3R ltV 3R ltR tRtVtV ;t	# )TestCFreeThreadingc                  < \         P                  V n        \         P                  P                  ;\         n        \         P                  n        \         P
                  V n        \         P                  P                  ;\         n        \         P                  n        \         P                  V n	        \         P                  P                  ;\         n        \         P                  n        \         P                  V n        \         P                  P                  ;\         n        \         P                  n        \        SV `A  4       # r   )r   r5   r   r9   _c_current_taskr/   r   r   r   r   _CTaskrV   r   r   _CFuturer   r   r   s   &r   r   TestCFreeThreading.setUp   s    !(!5!5<CMM<Y<YYw}}9%//6=mm6P6PPGMM3 ,3MM,@,@@w}})">>29//2J2JJ/w}r   c                p  < V P                   ;\        n        \        P                  n        V P                  ;\        n        \        P                  n        V P                  ;\        n        \        P                  n        V P                  ;\        n	        \        P                  n	        \        SV `1  4       # r   )r   r   r5   r9   r   r/   r   r   r   rV   r   r   r   r   s   &r   r   TestCFreeThreading.tearDown   su    <@<R<RRw}}96:6I6IIGMM3,0NN:w}})262B2BB/w!!r   c                H    \         P                  P                  ! V3R V/VB # r   r   r9   r   r   s   &&&,r   rE   TestCFreeThreading.factory   s!    }}##D>t>v>>r   r   r   r   s   @@r   r   r      s     	"? ?r   r   c                   *   a  ] tR t^t o RR ltRtV tR# )TestEagerPyFreeThreadingc                P    \         P                  P                  ! V3R V/VBRV/B # r8   eager_startr   r>   r8   r&   r   r   s   &&&&,r   rE    TestEagerPyFreeThreading.factory   s&    }}$$TXXXKXXr   r
   NTr   r   r   r   rE   r   r   r   s   @r   r   r      s     Y Yr   r   c                   *   a  ] tR t^t o RR ltRtV tR# )TestEagerCFreeThreadingc                P    \         P                  P                  ! V3R V/VBRV/B # r   r   r   s   &&&&,r   rE   TestEagerCFreeThreading.factory   s&    }}##DWtWvW;WWr   r
   Nr   r   r   s   @r   r   r      s     X Xr   r   )r   rd   unittestr   r   rr   r   r   test.supportr   requires_working_threading	Exceptionr	   r   r   r   
skipUnlesshasattrr9   r   r   r   r
   r   r   <module>r      s           )  + +4 8	) 	0Q Qh@+X @0 
WW]]N;=PQ?*H ? R?2Y2 Y
 
WW]]N;=PQX0( X RXr   