+
    BiX                         ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
Ht ^RIHtHt ^RIHtHtHt  ! R R]]]4      tR t]R	8X  d   ]P,                  ! 4        R# R# )
    N)futures)support)ExecutorTestmul)BaseTestCaseThreadPoolMixinsetup_modulec                   b  a  ] tR t^t o R tR tR t]P                  ! R4      R 4       t	]P                  ! 4       ]P                  ! ]! ]R4      R4      ]P                  ! R4      R	 4       4       4       t]P                  ! 4       ]P                  ! ]! ]R4      R4      R
 4       4       tR tRtV tR# )ThreadPoolExecutorTestc                   a . oV3R lpV P                   P                  V\        ^
4      4       V P                   P                  RR7       V P	                  S\        ^
4      4       R# )zTests verifying issue 11777.c                 *   < SP                  V 4       R # N)append)nfinisheds   &D/usr/lib/python3.14/test/test_concurrent_futures/test_thread_pool.pyrecord_finishedRThreadPoolExecutorTest.test_map_submits_without_iteration.<locals>.record_finished   s    OOA    TwaitN)executormaprangeshutdownassertCountEqual)selfr   r   s   & @r   "test_map_submits_without_iteration9ThreadPoolExecutorTest.test_map_submits_without_iteration   sP    	 	/595D)hb	2r   c                    V P                  4       p\        ^ \        P                  ! 4       ;'       g    ^^,           4      pV P	                  VP
                  V4       R# )    N)executor_typeminosprocess_cpu_countassertEqual_max_workers)r   r   expecteds   &  r   test_default_workers+ThreadPoolExecutorTest.test_default_workers   sH    %%'rB00277a1<=..9r   c                   V P                  ^4      pR p\        P                  ! ^ 4      p\        ^VP                  ,          4       F  pVP                  W#4       K  	  V P                  \        VP                  4      VP                  4       \        ^VP                  ,          4       F  pVP                  4        K  	  VP                  RR7       R# )   c                 &    V P                  4        R # r   )acquire)locks   &r   acquire_lock<ThreadPoolExecutorTest.test_saturation.<locals>.acquire_lock!   s    LLNr   Tr   N)r"   	threading	Semaphorer   r'   submitr&   len_threadsreleaser   )r   r   r0   semis   &    r   test_saturation&ThreadPoolExecutorTest.test_saturation   s    %%a(	 !!!$rH1112AOOL. 3X../1F1FGrH1112AKKM 3t$r   z(gh-117344: test is flaky without the GILc                r   V P                  4       pVP                  \        ^^4      P                  4        VP                  \        ^^4      P                  4        VP                  \        ^^4      P                  4        V P	                  \        VP                  4      ^4       VP                  RR7       R# )   Tr   N)r"   r4   r   resultr&   r5   r6   r   )r   r   s   & r   test_idle_thread_reuse-ThreadPoolExecutorTest.test_idle_thread_reuse,   s    %%'R#**,Q"))+Q#**,X../3t$r   register_at_forkzneed os.register_at_forkcpuc           
       a V3R  lo\         P                  ! ^4      ;_uu_ 4       pVP                  SV4       \        ^24       FU  p\         P                  ! ^\
        P                  ! R4      R7      ;_uu_ 4       pVP                  \        4       RRR4       KW  	  RRR4       R#   + '       g   i     Kt  ; i  + '       g   i     R# ; i)c                 ,   < V P                  SV 4       R # r   )r4   )poolr4   s   &r   r4   EThreadPoolExecutorTest.test_hang_global_shutdown_lock.<locals>.submit;   s    KK%r   fork)
mp_contextN)r   ThreadPoolExecutorr4   r   ProcessPoolExecutormpget_contexttuple)r   rE   _workersr4   s   &   @r   test_hang_global_shutdown_lock5ThreadPoolExecutorTest.test_hang_global_shutdown_lock5   s    	& ''**dKK%2Y00r~~f?UVVZaNN5) WV  +* WVV	 +**s$   AB;;B'B;'B82	B;;C	c                   a  V 3R  lp\         P                  ! ^4      ;_uu_ 4       pVP                  V4      P                  4       pRRR4       S P	                  X^ 4       R#   + '       g   i     L$; i)c                    < SP                  \        R 4      ;_uu_ 4        \        P                  ! R4      P	                  R R7      p V P                  4        RRR4       X P                  4        V P                  #   + '       g   i     L,; i)z2use of fork\(\) may lead to deadlocks in the childrG   c                      ^# )    rV   r   r   <lambda>vThreadPoolExecutorTest.test_process_fork_from_a_threadpool.<locals>.fork_process_and_return_exitcode.<locals>.<lambda>N   s    !r   )targetN)assertWarnsRegexDeprecationWarningrK   rL   Processstartjoinexitcode)pr   s    r    fork_process_and_return_exitcodedThreadPoolExecutorTest.test_process_fork_from_a_threadpool.<locals>.fork_process_and_return_exitcodeJ   sk    &&'9'\^ ^NN6*22)2D	^ FFH::^ ^s   8A<<B	N)r   rI   r4   r>   r&   )r   ra   rE   process_exitcodes   f   r   #test_process_fork_from_a_threadpool:ThreadPoolExecutorTest.test_process_fork_from_a_threadpoolE   sW    
	 ''**d#{{+KLSSU + 	)1- +*s    A""A2	c                  aa \         P                  ! 4       o. oVV3R  lpV P                  ^R7      ;_uu_ 4       pVP                  VRR7      p \        P
                  ! VP                  VRR.^ R7      4      ;_uu_ 4       pV P                  \        4      ;_uu_ 4        \        V4       RRR4       RRR4       SP                  4        VP                  4        RRR4       V P                  SRR	.4       R#   + '       g   i     LV; i  + '       g   i     La; i  SP                  4        i ; i  + '       g   i     La; i)
c                    < SP                  R V : R24        SP                  4        SP                  R V : R24       R#   SP                  R T : R24       i ; i)zident=z startedz stoppedN)r   r   )identlog
stop_events   &r   
log_n_waitRThreadPoolExecutorTest.test_executor_map_current_future_cancel.<locals>.log_n_wait\   sR    JJ&%*+0!

feXX./

feXX./s   A A)max_workersfirst)rh   secondthird)timeoutNzident='first' startedzident='first' stopped)r2   Eventr"   r4   
contextlibclosingr   assertRaisesTimeoutErrornextsetr>   assertListEqual)r   rk   rE   futgenri   rj   s   &    @@r   'test_executor_map_current_future_cancel>ThreadPoolExecutorTest.test_executor_map_current_future_cancelX   s    __&
	0 A..$++j+8C!''HHZ(G)<aHH **<88S	 9  JJL / 	S#:<S"TU 98    /.sS   D52D D	 C:,D	4D < D5:D
D	DD  D22D55E	rV   N)__name__
__module____qualname____firstlineno__r   r)   r:   r   requires_gil_enabledr?   requires_forkunittest
skipUnlesshasattrr$   requires_resourcerP   rd   r|   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s     3:
% !!"LM% N% %78:TUu%* & V * %78:TU. V ."V Vr   r   c                      \        4        R # r   )r	   rV   r   r   setUpModuler   t   s    Nr   __main__)rs   multiprocessingrK   multiprocessing.processmultiprocessing.utilr$   r2   r   
concurrentr   testr   r   r   r   utilr   r   r	   r   r   r~   mainrV   r   r   <module>r      s[        	     ' = =bV_lL bVJ zMMO r   