+
    Bi`                       ^ RI t ^ RIt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ 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" ^ RIH#t# ^ RIH$t$ ^ RIH%t% ^ RIH&t& ^ R	IH't' ]"PP                  ! R
4      t)] PT                  ! 4        ^ RI+t+^ RI,t-^ RI.t-^ RI/t-^ RI0t-^ RI1t-^ RI2t-^ RI,H3t3 ^ RI-H4t4  ^ RI-H5t5 ]5Pl                  t7 ^ RI9H:t:H;t; Rt< ^ RI-H=t= Rt> ^ RI?t?] P                  '       d   ] P                  ! R4      hRtBR tCR tDR tE]	P                  R8X  d
   ^ RI-HGtG R tH]4P                  tJRtKRtL]L'       d	   RRRutMtNtOMRRRutMtNtO] P                  tQRtR]S! ])RR4      '       * tT]P                  R8H  tVR  tW ]	P                  ! R!4      tYR#R$.tZ ^ R%I[H\t\H]t]H^t^H_t_ R& taR' tb ! R( R)] P                  4      td ! R* R+]`4      te ! R, R-]`4      tfR. tg ! R/ R04      th ! R1 R2]f4      ti ! R3 R4]-P                  4      tk ! R5 R6]f4      tlR7 tmR8 tn ! R9 R:]f4      to ! R; R<]f4      tp ! R= R>]f4      tq ! R? R@]f4      tr ! RA RB]f4      ts ! RC RD]`4      ttRE tu ! RF RG]`4      tv ! RH RI]`4      tw ! RJ RK]f4      tx ! RL RM]f4      ty ! RN RO]f4      tz ! RP RQ]f4      t{RRR lt|RS t}RT t~RU t ! RV RW]`4      t ! RX RY]4      tRZ t ! R[ R\]f4      tR] tR^ t ! R_ R`]f4      t ! Ra Rb]f4      t^ RcI0HtHtHt  ! Rd Re]`4      tRf t ! Rg Rh]4      t ! Ri Rj]4      t]EP!                  Rk]Rl7       ]EP!                  Rm]RRn7       ]EP!                  Ro]]Rp7        ! Rq Rr]f4      t]EP$                  ! 4       tRs t ! Rt Ru]4      t]EP!                  Rv]Rl7        ! Rw Rx]4      t]EP!                  Rv4       Ryt ! Rz R{]f4      t]!EP2                  ! R|4       ! R} R~]f4      4       t ! R R4      t ! R R] P                  4      t]C! R4      t ! R R]f4      t ! R R]f4      t ! R R]f4      t ! R R]f4      t] EPD                  ! ]7R4      ]!EP2                  ! R|4       ! R R]f4      4       4       t ! R R]f4      t ! R R]\4      t ! R R]f4      t] EPD                  ! ]>R4      ]!EP2                  ! R|4       ! R R]f4      4       4       t ! R R]f4      t ! R R] P                  4      t ! R R]f4      t ! R R]f4      t ! R R] P                  4      t]!EP2                  ! R|4       ! R R] P                  4      4       t]!EP2                  ! R4      ]!EP2                  ! R|4       ! R R] P                  4      4       4       tR t]!EP2                  ! R|4       ! R R] P                  4      4       tR tR tR tR t ! R R]`4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t ! R R] P                  4      t] EP                  ! ]P                  R8H  R4       ! R R] P                  4      4       t ! R R] P                  4      t ! R R] P                  4      t]!EP2                  ! R|4       ! R R] P                  4      4       t ! R R] P                  4      t ! R R]f4      t ! R R]f4      t ! R R] P                  4      t ! R R]`4      t ! R R]4      t ! R R]4      t ! R R]4      tRR lt] EP                  ! ]! ])R4      '       * R4      ] EP                  ! ]P                  R8g  R4       ! R R] P                  4      4       4       tR#   ]8 d    Rt7 EL1i ; i  ]8 d    Rt< EL6i ; i  ]8 d    Rt> EL=i ; i  ]8 d    Rt? ELHi ; i   R"tY EL; i  ]8 d    ]`t\R;t];t^t_ ELi ; i)    N)support)hashlib_helper)import_helper)	os_helper)script_helper)socket_helper)threading_helper)warnings_helper_multiprocessingwait)util)	reductionF)ValuecopyT)shared_memoryz?libasan has a pthread_create() dead lock related to thread+fork皙?c                 $    V P                  R 4      # )latin)encode)ss   &1/usr/lib/python3.14/test/_test_multiprocessing.pyr   r   _   s    88G    c                     \        V \        P                  P                  4      '       d#   V P	                  4        V P                  4        R # R # N)
isinstancemultiprocessingqueuesQueueclosejoin_threadqueues   &r   close_queuer$   c   s5    %//5566 7r   c                 2    \         P                  ! V 4       R # r   )r	   r!   )processs   &r   join_processr'   i   s       )r   posix)resource_trackerc                 @    \         P                  V,          ! V 4       R # r   )r)   _CLEANUP_FUNCS)namertypes   &&r   _resource_unlinkr.   r   s    ''.t4r   g=
ףp=?gffffff?gffffff?      @HAVE_BROKEN_SEM_GETVALUEwin32c                 6    Ve
   VR8  d   R p\        V .V4      # )N        r   )handletimeouts   &&r   wait_for_handler6      s"    w}'""r   SC_OPEN_MAX   __main__$test.test_multiprocessing_forkserver)	Structurec_intc_double
c_longlongc                     Rp  \         P                  ! R4      pTR8X  g   Y8  d   R# \        P
                  ! RT ,          4      h  \        \        3 d     R# i ; i)zACheck that the system supports enough semaphores to run the test.r8   SC_SEM_NSEMS_MAXNzHThe OS doesn't support enough semaphores to run the test (required: %d).)ossysconfAttributeError
ValueErrorunittestSkipTest)	nsems_minnsemss     r   check_enough_semaphoresrJ      sj     I

-. {e(


 >@IJ K K J' s   A AAc                   a  V 3R lpV# )a  Returns a decorator: raises SkipTest when SM != spawn at test time.

This can be useful to save overall Python test suite execution time.
"spawn" is the universal mode available on all platforms so this limits the
decorated test to only execute within test_multiprocessing_spawn.

This would not be necessary if we refactored our test suite to split things
into other test files when they are not start method specific to be rerun
under all start methods.
c                 J   <a  \         P                  ! S 4      VV 3R  l4       pV# )c                     < \         P                  ! 4       ;pR 8w  d   \        P                  ! RV: RS 24      hS! V / VB # )spawnstart_method=z, not 'spawn'; )r   get_start_methodrF   rG   )argskwargsstart_methodreason	test_items   *, r   spawn_check_wrapperKonly_run_in_spawn_testsuite.<locals>.decorator.<locals>.spawn_check_wrapper   sG     / @ @ BBwN''=</(QRRd-f--r   )	functoolswraps)rU   rV   rT   s   f r   	decorator.only_run_in_spawn_testsuite.<locals>.decorator   s&    		#	. 
$	.
 #"r    )rT   rZ   s   f r   only_run_in_spawn_testsuiter]      s    # r   c                   p   a  ] tR t^t o Rt]P                  ! ]P                  R8H  R4      R 4       t	Rt
V tR# )TestInternalDecoratorszBLogic within a test suite that could errantly skip tests? Test it!r1   ztest requires that fork exists.c                4   \         P                  ! 4       R 8w  d   \        P                  ! R4      h \	        R4      R 4       p\         P                  ! RR7      p \         P                  ! R RR7       V P                  X! 4       ^4       \         P                  ! R	RR7       V P                  \        P                  4      ;_uu_ 4       pV! 4        RRR4       V P                  R\        XP                  4      4       V P                  R
\        VP                  4      4       \         P                  ! VRR7       R#   \
         d    pT P                  RT 24        Rp?ELRp?ii ; i  + '       g   i     L; i  \         P                  ! TRR7       i ; i)rN   z'only run in test_multiprocessing_spawn.ztesting this decoratorc                      ^#    r\   r\   r   r   return_four_if_spawnUTestInternalDecorators.test_only_run_in_spawn_testsuite.<locals>.return_four_if_spawn   s    r   z.expected decorated `def` not to raise; caught NT
allow_noneforceforkrO   )r   rP   rF   rG   r]   	Exceptionfailset_start_methodassertEqualassertRaisesassertInstr	exception)selfrd   errorig_start_methodctxs   &    r    test_only_run_in_spawn_testsuite7TestInternalDecorators.test_only_run_in_spawn_testsuite   s=   ++-8##$MNN	N()AB C
 ,<<M		L,,WDA13Q7,,V4@""8#4#455$& 6MM2C4FGMM/3s}}+=>,,->dK  	NIIFseLMM	N 65
 ,,->dKs=   D= A.E= 	E*AE= =E'E""E'*E:	5E= =Fr\   N)__name__
__module____qualname____firstlineno____doc__rF   skipIfsysplatformrw   __static_attributes____classdictcell____classdict__s   @r   r_   r_      s2     L__S\\W,.OPL QLr   r_   c                   ,   a  ] tR t^t o R tR tRtV tR# )TimingWrapperc                     Wn         R V n        R # r   )funcelapsed)rs   r   s   &&r   __init__TimingWrapper.__init__   s    	r   c                    \         P                  ! 4       p V P                  ! V/ VB \         P                  ! 4       V,
          V n        #   \         P                  ! 4       T,
          T n        i ; ir   )time	monotonicr   r   )rs   rQ   kwdsts   &*, r   __call__TimingWrapper.__call__   sK    NN	099d+d+>>+a/DL4>>+a/DLs   A
 
#A-)r   r   Nry   rz   r{   r|   r   r   r   r   r   s   @r   r   r      s     0 0r   r   c                   X   a  ] tR tRt o Rt]! 4       tRtR tR t	R t
]
tV 3R ltRtV tR# )	BaseTestCasei  Nc                F    \         '       d   V P                  W^4       R# R#    N)CHECK_TIMINGSassertAlmostEqualrs   abs   &&&r   assertTimingAlmostEqual$BaseTestCase.assertTimingAlmostEqual	  s    =""1+ r   c                V     V! V!  pV P                  W4      #   \         d     R # i ; ir   )rn   NotImplementedError)rs   valuer   rQ   ress   &&&* r   assertReturnsIfImplemented'BaseTestCase.assertReturnsIfImplemented  s7    	0+C ##E// # 		s    ((c                    \        R 4      h)z#shouldn't try to pickle a test case)r   )rs   rQ   s   &*r   
__reduce__BaseTestCase.__reduce__  s    !"GHHr   c                6   < V ^8  d   Qh/ S[ S[,          ;R&   # )   START_METHODS)setrq   )formatr   s   "r   __annotate__BaseTestCase.__annotate__  s      s8#	 r   r\   )	processesmanagerthreads)ry   rz   r{   r|   ALLOWED_TYPESr   r   rS   r   r   r   __reduce_ex____annotate_func__r   r   r   s   @r   r   r     s4     7M!eML,0I M1  r   r   c                      V P                  4       #   \         dF     T P                  u #   \         d(     T P                  u u #   \         d    \        hi ; ii ; ii ; ir   )	get_valuerD   _Semaphore__value_valuer   rs   s   &r   r   r      sg    	*~~ *	*))) 	**{{"! *))*	**s:    A",A"AAAA"AAA"c                   &   a  ] tR tRt o R tRtV tR# )DummyCallablei0  c                (    VP                  ^4       R#    Nput)rs   qcs   &&&r   r   DummyCallable.__call__1  s    	ar   r\   N)ry   rz   r{   r|   r   r   r   r   s   @r   r   r   0  s      r   r   c                     a  ] tR tRt o R7tR tR t]P                  ! R4      R 4       t	]
R 4       tR t]
R 4       tR	 t]
R
 4       tR t]
R 4       t]
R 4       tR t]P*                  ! ]P.                  R4      R 4       t]
R 4       t]
R 4       t]
R 4       t]
R 4       t]
R 4       tR8R lt]P>                  ! ] PB                  R8H  R4      R 4       t"]P>                  ! ] PB                  R8H  R4      R 4       t#R t$R t%R t&R t']
R  4       t(R! t)]
R" 4       t*R# t+]
R9R$ l4       t,R% t-]P                  ! R&4      R' 4       t.R( t/]
R) 4       t0R* t1]
R+ 4       t2R, t3]
/ 3R- l4       t4R. t5R/ t6]7R:R0 l4       t8R1 t9R2 t:R3 t;R4 t<R5 t=R6t>V t?R# );_TestProcessi6  c                $   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  4       pVP                  pV P                  VP                  4       4       V P                  VP                  4       V P                  V\        4       V P                  \        V4      ^ 8  4       V P                  VP                  \        P                  ! 4       4       V P                  VP                   R4       R# )r   test not appropriate for {}N)TYPEskipTestr   current_processauthkey
assertTrueis_aliveassertFalsedaemonassertIsInstancebyteslenrn   identrB   getpidexitcode)rs   currentr   s   &  r   test_current_TestProcess.test_current:  s    99	!MM7>>tyyIJ&&(//((*+(gu-Gq()		4))40r   c                L   V P                   R 8X  d   V P                  RV P                    24       \        P                  \        P
                  ! \        P                  4      \        P                  ! \        P                  4      \        P                  ! \        P
                  ! \        P                  4      4      .pV F`  pV P                  V4       V P                  4       pVP                  4        VP                  4        V P                  VP                  ^ 4       Kb  	  R# )r   test not appropriate for N)r   r   r   
executablerB   fsencoder   FakePathset_executableProcessstartjoinrn   r   )rs   pathspathps   &   r   test_set_executable _TestProcess.test_set_executableH  s    99	!MM5dii[ABNNKK's~~.r{{3>>:;	
 D%AGGIFFHQZZ+ r   cpuc           
        ^R^.R3p\         \        3p\        P                  ! W4      pV F  w  rEV P	                  WER7      ;_uu_ 4        V P                  ^4      pV P                  V P                  V! Wd34      R7      pRVn        VP                  4        VP                  4       pV P                  W4       VP                  4        \        V4       RRR4       K  	  R#   + '       g   i     K  ; i)r   rq   )rQ   	args_typetargetrQ   TNr   )listtuple	itertoolsproductsubTestr   r   
_test_argsr   r   getrn   r   r$   )	rs   
args_cases
args_types
test_casesrQ   r   r   r   
child_argss	   &        r   test_args_argument_TestProcess.test_args_argumentX  s     T*
E]
&&z>
)OD4==JJqMLLi	>RLS	UUW
  2A >=  *===s   B	C""C3c                (    VP                  V4       R # r   r   )clsr   args   &&&r   r   _TestProcess._test_argsm  s    	c
r   c                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  V P                  R7      pV P                  VP                  V P                  4       P                  4       V P                  V P                  RR7      pV P                  VP                  4       V P                  V P                  RR7      pV P                  VP                  4       R# )r   r   r   Tr   r   FN)
r   r   r   r   _testrn   r   r   r   r   )rs   proc0proc1proc2s   &   r   test_daemon_argument!_TestProcess.test_daemon_argumentq  s    99	!MM7>>tyyIJ DJJ/t';';'='D'DEDJJt<%DJJu=&r   c                D   V P                  4       pVP                  V4       VP                  V4       VP                  VP                  4       V P                  R 8w  dB   VP                  \	        VP
                  4      4       VP                  VP                  4       R# R# )r   N)r   r   r,   r   r   r   pid)r   r   rQ   r   r   s   &&*, r   r  _TestProcess._test}  sl    %%'	d	d	gll88y EE%()EE'++ !r   c                p   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  V P	                  4       4       V P                  RR7      w  rV P                  V P                  V3R7      pVP                  4        VP                  4        VP                  4       w  rEV P                  W@P                  4       P                  4       V P                  V\        P                  ! 4       4       V P                  WPP                  4       P                   4       R# )r   r   Fduplexr   N)r   r   r   assertIsNoneparent_processPiper   _test_send_parent_processr   r   recvrn   r   r	  rB   r   r,   )rs   rconnwconnr   
parent_pidparent_names   &     r   test_parent_process_attributes+_TestProcess.test_parent_process_attributes  s    99	!MM7>>tyyIJ$--/0yyy.LL > >eXLN			"'**,
%9%9%;%?%?@RYY[1&:&:&<&A&ABr   c                t    ^ RI Hp VP                  V! 4       P                  V! 4       P                  .4       R# )r   r  N)multiprocessing.processr  sendr	  r,   r   r  r  s   && r   r  &_TestProcess._test_send_parent_process  s(    :

N$((.*:*?*?@Ar   c                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  RR7      w  rV P	                  V P
                  V3R7      pVP                  4        VP                  \        P                  R7      '       g   \        R4      hVP                  4       pV P                  VR4       VP                  4        VP                  4        VP                  \        P                  R7      '       g   \        R4      hVP                  4       pV P                  VR4       R	# )
r   r   Fr  r   r5   z(Could not communicate with child processalive	not aliveN)r   r   r   r  r   _test_create_grandchild_processr   pollr   LONG_TIMEOUTAssertionErrorr  rn   	terminater   )rs   r  r  r   parent_process_statuss   &    r   test_parent_process _TestProcess.test_parent_process  s    99	!MM7>>tyyIJ
 yyy.LL77ui  I		zz'"6"6z77 !KLL %

.8		zz'"6"6z77 !KLL %

.<r   c                    V P                  V P                  V3R 7      pVP                  4        \        P                  ! R4       R# )r   i,  N)r   _test_report_parent_statusr   r   sleep)r   r  r   s   && r   r#  ,_TestProcess._test_create_grandchild_process  s0    KKs==UIKN		

3r   c                    ^ RI Hp TP                  V! 4       P                  4       '       d   RMR4       V! 4       P	                  \
        P                  R7       TP                  V! 4       P                  4       '       d	   R4       R# R4       R# )r   r  r!  r"  r   N)r  r  r  r   r   r   SHORT_TIMEOUTr  s   && r   r,  '_TestProcess._test_report_parent_status  s`    :

n.77997{Kg&;&;<

n.77997K{Kr   c                   V P                  ^4      pV P                  4       pV^^3pR^RR/pRpV P                  V P                  W4VR7      pRVn        V P                  4       pV P                  R8w  d'   V P                  VP                  VP                  4       V P                  VP                  4       R4       V P                  VP                  R4       V P                  W`P                  4       4       V P                  \        V P                  4       4      \        4       V P                  VP                  R	4       VP!                  4        V P                  VP                  R	4       V P                  VP                  4       R4       V P#                  W`P                  4       4       V P                  VP%                  4       VR
,          4       V P                  VP%                  4       V4       V P                  VP%                  4       VP&                  4       V P                  R8w  dU   V P                  VP%                  4       VP                  4       V P                  VP%                  4       VP(                  4       VP+                  4        V P                  VP                  ^ 4       V P                  VP                  4       R4       V P                  W`P                  4       4       \-        V4       R	# )r   hellobyegRQ@SomeProcess)r   rQ   rR   r,   Tr   FNr   NN)r   Eventr   r  r   r   r   rn   r   r   assertNotInactive_childrenassertIstyper   r   r   rp   r   r,   r	  r   r$   )rs   r   erQ   rR   r,   r   r   s   &       r   test_process_TestProcess.test_process  s%   JJqMJJL1ay"eD)LL::Dd   &&(99	!QYY8u-4(0023d4//12D9T*		T*t,a--/0$r(+&)!&&)99	!QUUWgoo6QUUWaee,	Q'u-0023Ar   zneeds native_idc                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       \        P                  ! 4       P
                  pV P                  ^4      pV P                  V P                  V3R7      pVP                  4        VP                  4       pVP                  4        \        V4       V P                  W4       R# r   r   r   N)r   r   r   	threadingmain_thread	native_idr   r   "_test_process_mainthread_native_idr   r   r   r$   assertNotEqual)rs   current_mainthread_native_idr   r   child_mainthread_native_ids   &    r   !test_process_mainthread_native_id._TestProcess.test_process_mainthread_native_id  s    99	!MM7>>tyyIJ'0'<'<'>'H'H$JJqMLL G GqdLS		%&UUW"	A8Ur   c                f    \         P                  ! 4       P                  pVP                  V4       R # r   )rA  rB  rC  r   )r   r   mainthread_native_ids   && r   rD  /_TestProcess._test_process_mainthread_native_id  s$    (446@@	"#r   c                2    \         P                  ! ^d4       R# d   Nr   r-  r   s   &r   _sleep_some_TestProcess._sleep_some  s    

3r   c                R    VP                  4        \        P                  ! ^d4       R# rN  )r   r   r-  r   events   &&r   _sleep_some_event_TestProcess._sleep_some_event  s    		

3r   c                    \         P                   ! \         P                  \         P                  4       V P                  V4       R # r   )signalSIGINTSIG_DFLrW  rU  s   &&r   _sleep_no_int_handler"_TestProcess._sleep_no_int_handler  s&    fmmV^^4e$r   c                2    \         P                  ! V4       R # r   rP  )r   delays   &&r   _test_sleep_TestProcess._test_sleep  s    

5r   Nc                  a V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  4       pV'       g   V P                  pV P                  W#3R7      oRSn        SP                  4        V P                  SP                  4       R4       V P                  SV P                  4       4       V P                  SP                  R4       \        SP                  4      pV P                  V! ^ 4      R4       V P                  VP                   R4       V P                  SP                  4       R4       V P                  V! R4      R4       V P                  VP                   R4       V P                  SP                  4       R4       \"        P$                  pVP'                  V4      '       g6   SP)                  4        SP                  4        V P+                  RV R24       V! S4       \-        \.        R4      '       d   V3R	 lp\.        P.                  ! \.        P0                  V4      p \.        P2                  ! ^
4       V P                  V! 4       R4       \.        P2                  ! ^ 4       \.        P.                  ! \.        P0                  V4       MV P                  V! 4       R4       V P                  VP                   R4       V P                  SP                  4       R
4       V P5                  SV P                  4       4       SP                  4        SP                  #   \.        P2                  ! ^ 4       \.        P.                  ! \.        P0                  T4       i ; i)r   r   r   TNr3   zevent not signaled in  secondsalarmc                  (   < \        R S,          4      h)zjoin took too long: %sRuntimeError)rQ   r   s   *r   handler+_TestProcess._kill_process.<locals>.handler5  s    "#;a#?@@r   FrA   )r   r   r   r7  rW  r   r   r   rn   r   rp   r9  r   r   r   r   r   r   r0  r   r'  rl   hasattrrZ  SIGALRMre  r8  )	rs   methr   rV  r   r5   ri  old_handlerr   s	   &&&     @r   _kill_process_TestProcess._kill_process  sj   99	!MM7>>tyyIJ

++FLLXL6		t,a--/0T*QVV$a$'$$T\\37t,b4($$T\\37t,''zz'""KKMFFHII.wix@AQ67##A --@K;R   .Qfnnk:TVT*$$T\\37u-D0023	zz Qfnnk:s   
-M =M?ntz
POSIX onlyc                |    V P                  \        P                  P                  4      pV P	                  V^4       R# r   )ro  r   r   	interruptrn   rs   r   s   & r   test_interrupt_TestProcess.test_interruptJ  s.    %%o&=&=&G&GH1%r   c                    V P                  \        P                  P                  V P                  R 7      pV P                  V\        P                  ) 4       R# r   N)ro  r   r   rs  r]  rn   rZ  r[  rt  s   & r   test_interrupt_no_handler&_TestProcess.test_interrupt_no_handlerR  s@    %%o&=&=&G&GPTPjPj%kFMM>2r   c                    V P                  \        P                  P                  4      pV P	                  V\
        P                  ) 4       R # r   )ro  r   r   r'  rn   rZ  SIGTERMrt  s   & r   test_terminate_TestProcess.test_terminateW  s4    %%o&=&=&G&GHFNN?3r   c                
   V P                  \        P                  P                  4      p\        P
                  R 8w  d$   V P                  V\        P                  ) 4       R# V P                  V\        P                  ) 4       R# rq  N)
ro  r   r   killrB   r,   rn   rZ  SIGKILLr|  rt  s   & r   	test_kill_TestProcess.test_kill[  sU    %%o&=&=&B&BC77d?X7X7r   c                     \         P                  ! 4       pV P                  V\        4       V P                  V^4       R#   \         d    ^p L9i ; ir   )r   	cpu_countr   r   intassertGreaterEqual)rs   cpuss   & r   test_cpu_count_TestProcess.test_cpu_countb  sM    	",,.D 	dC(a( # 	D	s   A AAc                   V P                  \        V P                  4       4      \        4       V P	                  4       pV P                  VP                  RR 7      pV P                  W P                  4       4        RVn        VP                  4        V P                  W P                  4       4       VP                  4        VP                  4        V P                  W P                  4       4       R#   TP                  4        i ; i)r   TNr\   )rn   r;  r9  r   r7  r   r   r8  r   r   rp   r   r   )rs   rV  r   s   &  r   test_active_children!_TestProcess.test_active_childrenj  s    d2245t<

LL

L40023	AHGGIMM!1134IIK	0023 IIKs   ;6C2 2Dc                    VP                  V4       \        V4      ^8  d[   \        ^4       FI  pV P                  V P                  WV.,           3R7      pVP                  4        VP                  4        KK  	  R# R# r   r   N)r  r   ranger   _test_recursionr   r   )r   r  idir   s   &&&  r   r  _TestProcess._test_recursion{  se    

2r7Q;1XKK..eV_    	  r   c                @   V P                  R R7      w  rV P                  V. 4       \        P                  ! \        4       . pVP                  4       '       d"   VP                  VP                  4       4       K7  . ^ .^ ^ .^ ^.^.^^ .^^..pV P                  W44       R# )Fr  N)	r  r  r   r-  DELTAr$  appendr  rn   )rs   r  r  resultexpecteds   &    r   test_recursion_TestProcess.test_recursion  s    yyy.UB'

5jjllMM%**,' cAAcAA 	*r   c                (    VP                  R 4       R# )g      $@Nr   rU  s   &&r   _test_sentinel_TestProcess._test_sentinel  s    

4r   c                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  4       pV P	                  V P
                  V3R7      pV P                  \        4      ;_uu_ 4        VP                   RRR4       VP                  4        V P                  VP                  4       VP                  pV P                  V\        4       V P                  \        VRR7      4       VP!                  4        VP                  4        V P#                  \        V^R7      4       R#   + '       g   i     L; i)r   r   r   Nr3   r   )r   r   r   r7  r   r  ro   rE   sentinelr   
addCleanupr   r   r  r   r6   r   r   )rs   rV  r   r  s   &   r   test_sentinel_TestProcess.test_sentinel  s    99	!MM7>>tyyIJ

LL 3 35(LCz**JJ +		::h,3?@			!<= +*s   EE	c                Z    Ve   VP                  4        \        P                  ! V4       R # r   )r   r   exit)r   rcr   s   &&&r   _test_close_TestProcess._test_close  s    =EEGr   c                (   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  4       pV P	                  V P
                  RV/R7      pRVn        VP                  4        V P                  VP                  4       R4       V P                  \        4      ;_uu_ 4        VP                  4        RRR4       VP                  R4       VP                  4        V P                  VP                  4       R4       V P                  VP                  ^ 4       VP                  4        V P                  \        4      ;_uu_ 4        VP                  4        RRR4       V P                  \        4      ;_uu_ 4        VP                  4        RRR4       V P                  \        4      ;_uu_ 4        VP!                  4        RRR4       VP                  4        \"        P$                  ! V4      p?\&        P(                  ! 4        V P+                  V! 4       R4       \-        V4       R#   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i)r   r   r   )r   rR   TNF)r   r   r   r   r   r  r   r   rn   r   ro   rE   r    r   r   r   r'  weakrefrefgccollectr:  r$   )rs   r   r   wrs   &   r   
test_close_TestProcess.test_close  s   99	!MM7>>tyyIJJJLLL 0 0#qLB		t,z**GGI + 	
d	u-Q'		z**JJL +z**FFH +z**KKM +		[[^


bdD!A+ +** +*****s0   ?I"II.JI	I+	.I>	J	walltimec                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       \        P                  ! 4       pVR8X  d   ^M^dp\        V4       Uu. uF   pV P                  V P                  R	R7      NK"  	  ppV F  pVP                  4        K  	  V F  p\        V4       K  	  V F  pV P                  VP                  ^ 4       K!  	  \        V4       Uu. uF  pV P                  V P                  R7      NK!  	  ppV F  pVP                  4        K  	  \        P                  ! R4       V F  pVP                  4        K  	  V F  p\        V4       K  	  \         P"                  R8w  do   \$        P&                  ) .p\(        P*                  R8X  d!   VP-                  \$        P.                  ) 4       V F  pV P1                  VP                  V4       K!  	  R# R# u upi u upi )
r   r   rN   r   r   MbP?rq  darwinN){Gz?)r   r   r   r   rP   r  r   ra  r   r'   rn   r   rR  r   r-  r'  rB   r,   rZ  r|  r   r   r  r  rp   )rs   smNr  procsr   	exitcodess   &      r   test_many_processes _TestProcess.test_many_processes  s   99	!MM7>>tyyIJ--/wAC  ($"Q T%5%5GD" 	 $AGGI AO AQZZ+   ($"Q T%5%56" 	 $AGGI 

5AKKM AO 77d? ..)I||x'   &..1ajj)4  %$$s   )&G80%G=c                ~   \        4       p\        P                  ! V4      pV P                  4       pV P	                  WV3R 7      p?VP                  4        VP                  4        \        P                  ! 4        V P                  V! 4       R4       V P                  VP                  4       ^4       \        V4       R# r   N)r   r  r  r   r   r   r   r  r  r:  rn   r   r$   )rs   r   r  r   r   s   &    r   test_lose_target_ref!_TestProcess.test_lose_target_ref  s    O[[^JJLLLAL/			


bdD!!$Ar   c                n    VP                  \        P                  ! 4       4       VP                  4        R # r   )r   r   fd_countr   )rs   evtr   s   &&&r   _test_child_fd_inflation%_TestProcess._test_child_fd_inflation  s     	i  "#
r   c                ^   V P                   R 8X  d+   V P                  RP                  V P                   4      4       \        P                  ! 4       pVR8X  d!   V P                  RP                  V4      4       ^pV P                  4       pV P                  4       p\        V4       Uu. uF!  pV P                  V P                  W43R7      NK#  	  ppV F  pVP                  4        K  	   \        V4       Uu. uF  qTP                  4       NK  	  ppV P                  \        \        V4      4      ^V4       VP                  4        V F  pVP                  4        K  	  \!        V4       R# u upi u upi   TP                  4        T F  pTP                  4        K  	  \!        T4       i ; i)r   r   rj   r   N)r   r   r   r   rP   r7  r   r  r   r  r   r   rn   r   r   r   r$   )	rs   r  r  r  r   r  r  r   	fd_countss	   &        r   test_child_fd_inflation$_TestProcess.test_child_fd_inflation
  sV    99	!MM7>>tyyIJ--/< MM7>>rBCjjlJJL  ($"Q T%B%B#R" 	 $AGGI 	*/(3(Q(I3SY0!Y? GGI N$ 4 GGI Ns$   ''E,*E6 7E1'E6 1E6 66F,c                   a V3R  lpV3R lp\         P                  ! VR7      P                  4        \         P                  ! VRR7      P                  4        R# )c                  T   < \         P                  ! R 4       S P                  4        R# )      ?Nr   r-  r   r  s   r   func12_TestProcess._test_wait_for_threads.<locals>.func1+  s    JJsOGGIr   c                  T   < \         P                  ! ^4       S P                  4        R# )   N)r   r-  clearr  s   r   func22_TestProcess._test_wait_for_threads.<locals>.func2/  s    JJrNIIKr   r   Tr  N)rA  Threadr   )rs   r  r  r  s   &f  r   _test_wait_for_threads#_TestProcess._test_wait_for_threads)  s?    		 	&,,.d399;r   c                V   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  4       pV P	                  V P
                  V3R7      pVP                  4        VP                  4        V P                  VP                  4       4       R# r@  )
r   r   r   r7  r   r  r   r   r   is_set)rs   r  procs   &  r   test_wait_for_threads"_TestProcess.test_wait_for_threads6  su     99	!MM7>>tyyIJjjl||4#>#>cV|L

		

%r   c                    VP                  4        FE  w  r4VR 8X  d'   \        P                  ! 4       pVP                  4        MRp\	        \
        VR4       KG  	  VP                  4        R# )r    N)itemsioStringIOr    setattrr   r   )rs   r  break_std_streamsstream_nameactionstreams   &&&   r   _test_error_on_stdio_flush'_TestProcess._test_error_on_stdio_flushB  sR    #4#:#:#<K  Cd+ $= 		r   c           	     $   \         P                  ! 4       R .pV^ ,          P                  4        R F  pV F  p\        \        V4      p\        \        W#4        V P                  4       pV P                  V P                  V3R7      pVP                  4        VP                  4        V P                  VP                  4       4       V P                  VP                  ^ 4       \        \        W$4       K  	  K  	  R #   \        \        Y$4       i ; i)Nr   stdoutstderr)r  r  r    getattrr   r  r7  r   r  r   r   r   r  rn   r   )rs   streamsr  r  
old_streamr  r  s   &      r   test_error_on_stdio_flush_1(_TestProcess.test_error_on_stdio_flush_1N  s    ;;=$'
/K!$S+6
[1	:**,C<<t/N/N.1V ( 5DJJLIIKOOCJJL1$$T]]A6C9 " 0 C9s   B	C==Dc           	        R F  pR F  p\        \        V4      p V P                  4       pV P                  V P                  WAV/3R7      pVP                  4        VP                  4        V P                  VP                  4       4       V P                  VP                  ^ 4       \        \        W4       K  	  K  	  R#   \        \        Y4       i ; i)r  r   Nr  )r    remove)r  r   r7  r   r  r   r   r   r  rn   r   r  )rs   r  r  r  r  r  s   &     r   test_error_on_stdio_flush_2(_TestProcess.test_error_on_stdio_flush_2a  s     0K-$S+6
	:**,C<<t/N/N.13H-I ( KDJJLIIKOOCJJL1$$T]]A6C9 . 0 C9s   BCCc                R    \         P                  ! V4       V P                  4        R # r   r  )r  r`  s   &&r   _sleep_and_set_event!_TestProcess._sleep_and_set_eventr  s    

5	r   c                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       \        P                  ! 4       pVR8w  d!   V P                  RP                  V4      4       ^ RIHp VP                  4        RpV P                  4       pV P                  V P                  WT3R7      pVP                  4        VP                  p\        P                  ! Wq4       \        P                   ! VR,          4       V P                  4       pV P                  V P                  V3R7      p	V	P                  4        V	P#                  4        V P%                  VP'                  4       4       V P)                  V	P*                  ^ 4       VP#                  4        V P%                  VP'                  4       4       V P-                  VP*                  R4       R# )	r   r   
forkserver)_forkserverr  r   g       @N)r      )r   r   r   r   rP   multiprocessing.forkserverr  ensure_runningr7  r   r  r   _forkserver_pidrB   r  r   r-  r   r   r  rn   r   rp   )
rs   signumr  r  r`  r  r  r	  evt2r  s
   &&        r   check_forkserver_death#_TestProcess.check_forkserver_deathw  sQ    99	!MM7>>tyyIJ--/ MM7>>rBC:""$ jjl||4#<#<C<|P

))


53;zz|D$=$=TGL

&+		

%dmmX.r   c                D    V P                  \        P                  4       R # r   )r  rZ  r[  r   s   &r   test_forkserver_sigint#_TestProcess.test_forkserver_sigint  s    ##FMM2r   c                r    \         P                  R 8w  d"   V P                  \        P                  4       R# R# r  )rB   r,   r  rZ  r  r   s   &r   test_forkserver_sigkill$_TestProcess.test_forkserver_sigkill  s$    77d?''7 r   c                   V P                   R 8X  d   V P                  RV P                    24       \        P                  ! 4       R8w  d   V P                  R4       \        P                  P
                  pVP                  4        V P                  VP                  4       VP                  pV P                  V4       V P                  \        V4      ^4       VP                  pV P                  V4       \        P                  P                  W2R7      pVP                  4        V P!                  \"        P$                  R7      pVP'                  4        VP)                  4        V P+                  VP,                  ^ 4       R# )r   r   r   forkserver start method specificr   r   N)r   r   r   rP   r  r  r  r   r  _forkserver_authkeyassertGreaterr   _forkserver_address
connectionClientr    r   r   r  r   r   rn   r   )rs   r  r   addrclientr  s   &     r   test_forkserver_auth_is_enabled,_TestProcess.test_forkserver_auth_is_enabled  s   99	!MM5dii[AB++-=MM<=$//;;
!!#
22300 3w<,-- !++2242I ||388|,

		*r   c           	        V P                   R 8X  d   V P                  RV P                    24       \        P                  ! 4       R8w  d   V P                  R4       \        P                  P
                  pVP                  4        V P                  VP                  4       \        VP                  4      p\        P                  P                  P                  VRR4      ;_uu_ 4        RV,          Vn
        V P                  \         P"                  R7      pV P%                  \        P&                  4      ;_uu_ 4        VP)                  4        RRR4       ?RRR4       V P                  \         P"                  R7      pVP)                  4        VP+                  4        R#   + '       g   i     L[; i  + '       g   i     Le; i)r   r   r  r  r  N   Tr   )r   r   r   rP   r  r  r  r   r  r   r  rF   mockpatchobjectr   r   r  ro   AuthenticationErrorr   r   )rs   r  authkey_lenr  s   &   r   "test_forkserver_without_auth_fails/_TestProcess.test_forkserver_without_auth_fails  s6   99	!MM5dii[AB++-=MM<=$//;;
!!#
223*889]]  ''149 9 .2K-?J*<<sxx<0D""?#F#FGG

 H9 ||388|,

		 HG9 9s%   (AF5>F"		F5"F2-F55G	r\   r   r   r   r   N)r3   )@ry   rz   r{   r|   r   r   r   r   requires_resourcer   classmethodr   r  r  r  r  r)  r#  r,  r=  rF   
skipUnlessrA  _HAVE_THREAD_NATIVE_IDrH  rD  rR  rW  r]  ra  ro  r~   rB   r,   ru  ry  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  staticmethodr  r  r  r  r  r  r   r   r   s   @r   r   r   6  s    ,M1,  u% &(  
'  C B B=2  
 L L&P 99;LMV NV  $ $     % %  7r __RWW_l3& 4& __RWW_l33 4348)4"  +(  >   
@ z*!5 +!5F  > 
< 
<
& @B 	 	:&:"  $/L38
+4 r   r   c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )_UpperCaseri  c                    \         P                  P                  V 4       \         P                  ! 4       w  V n        V n        R # r   )r   r   r   r  
child_connparent_connr   s   &r   r   _UpperCaser.__init__  s.    ((.,;,@,@,B))r   c                   V P                   P                  4        \        V P                  P                  R 4       F,  pV P                  P                  VP                  4       4       K.  	  V P                  P                  4        R # r   )r*  r    iterr)  r  r  upperrs   r   s   & r   run_UpperCaser.run  sW     doo**D1AOO  + 2r   c                l    V P                   P                  V4       V P                   P                  4       # r   )r*  r  r  r/  s   &&r   submit_UpperCaser.submit  s+    a $$&&r   c                    V P                   P                  R 4       V P                   P                  4        V P                  P                  4        R # r   )r*  r  r    r)  r   s   &r   stop_UpperCaser.stop  s8    d# r   )r)  r*  N)
ry   rz   r{   r|   r   r0  r3  r6  r   r   r   s   @r   r'  r'    s     C '
   r   r'  c                   V   a  ] tR tRt o R	tR tR t]R 4       t]R 4       t	R t
RtV tR# )
_TestSubclassingProcessi  c                   \        4       pR Vn        VP                  4        V P                  VP	                  R4      R4       V P                  VP	                  R4      R4       VP                  4        VP                  4        R# )Tr3  HELLOworldWORLDN)r'  r   r   rn   r3  r6  r   )rs   
uppercasers   & r   test_subclassing(_TestSubclassingProcess.test_subclassing  sg     ]
 
**73W=**73W=r   c                H   V P                   R 8X  d+   V P                  RP                  V P                   4      4       \        P                  pV P                  \        P                  V4       V P                  V P                  V3R7      pVP                  4        VP                  4        \        VRR7      ;_uu_ 4       pVP                  4       pV P                  RV4       V P                  RV4       V P                  RV4       RRR4       R#   + '       g   i     R# ; i)	r   r   r   utf-8encodingZeroDivisionErrorztest_multiprocessing.pyz1/0 # MARKERN)r   r   r   r   TESTFNr  unlinkr   _test_stderr_flushr   r   openreadrp   )rs   testfnr  frt   s   &    r   test_stderr_flush)_TestSubclassingProcess.test_stderr_flush   s    99	!MM7>>tyyIJ!!	((&1||4#:#:&|K

		&7++q&&(CMM-s3MM3S9MM.#. ,+++s   ?ADD!	c                    \         P                  ! V\         P                  \         P                  ,          \         P                  ,          4      p\        VR RRR7      \
        n        ^^ ,           R# wrB  F)rD  closefdN)rB   rI  O_WRONLYO_CREATO_EXCLr   r  )r   rK  fds   && r   rH  *_TestSubclassingProcess._test_stderr_flush  sC    WWVR[[2::5		AB"cGUC
	!r   c                    \         P                  ! V\         P                  \         P                  ,          \         P                  ,          4      p\        VR RRR7      \
        n        \
        P                  ! V4       R# rP  )rB   rI  rS  rT  rU  r   r  r  )r   rT   rK  rV  s   &&& r   _test_sys_exit&_TestSubclassingProcess._test_sys_exit  sF    WWVR[[2::5		AB"cGUC
r   c                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       \        P                  pV P                  \        P                  V4       . R	OR3 F  pV P                  V P                  W!3R7      pRVn	        VP                  4        \        V4       V P                  VP                  ^4       \        VRR7      ;_uu_ 4       pVP                  4       pRRR4       V P                  XP!                  4       \#        V4      4       \$        P                  ! V4       K  	  . R
OpV F  w  rxV P'                  VR7      ;_uu_ 4        V P                  \(        P*                  VR7      pRVn	        VP                  4        \        V4       V P                  VP                  V4       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)r   r   zignore thisr   TrB  rC  NrQ   r   r      ))Tr   )Fr   ))   ra  )r   r   )r\   r   )r   r   r   r   rF  r  rG  r   rY  r   r   r'   rn   r   rI  rJ  rstriprq   rB   r   r   r  )	rs   rK  rT   r   rL  contentcasesrQ   r  s	   &        r   test_sys_exit%_TestSubclassingProcess.test_sys_exit  so   99	!MM7>>tyyIJ!!	((&1 
F D$7$7v>NOAAHGGIOQZZ+fw//1&&( 0W^^-s6{;IIf
  $ND4((LLtL<	Q  X6 )( $ 0/ )((s   &G'A G(G%(G9r\   Nr   )ry   rz   r{   r|   r   r?  rM  r"  rH  rY  re  r   r   r   s   @r   r9  r9    sF     "M/"    
&7 &7r   r9  c                 l    \        V R 4      '       d   V P                  4       # V P                  4       ^ 8H  # )empty)rk  ri  qsizer   s   &r   queue_emptyrl  J  s+    q'wwywwyA~r   c                 l    \        V R 4      '       d   V P                  4       # V P                  4       V8H  # )full)rk  rn  rj  )r   maxsizes   &&r   
queue_fullrp  P  s+    q&vvxwwyG##r   c                      a  ] tR tRt o ]R 4       tR t]R 4       tR t]R 4       t	R t
R t]R	 4       tR
 tR tR tR tR tR tR tRtV tR# )
_TestQueueiW  c                    VP                  4        \        ^4       F  pVP                  4        K  	  VP                  4        R# )   N)r   r  r   r   )r   r#   child_can_startparent_can_continuer  s   &&&& r   	_test_put_TestQueue._test_putZ  s1    qAIIK !r   c                   ^pV P                  VR7      pV P                  4       pV P                  4       pV P                  V P                  W#V3R7      pRVn        VP                  4        V P                  \        V4      R4       V P                  \        W!4      R4       VP                  ^4       VP                  ^R4       VP                  ^RR4       VP                  ^R4       VP                  ^RR4       VP                  ^4       \        P                  ! \        4       V P                  \        V4      R4       V P                  \        W!4      R4       \        VP                  4      p\        VP                  4      pV P                  \         P"                  V^R4       V P%                  VP&                  ^ 4       V P                  \         P"                  V^RR4       V P%                  VP&                  ^ 4       V P                  \         P"                  V^4       V P%                  VP&                  ^ 4       V P                  \         P"                  V^R\(        4       V P%                  VP&                  \(        4       V P                  \         P"                  V^R\*        4       V P%                  VP&                  ^ 4       V P                  \         P"                  V^R\,        R7       V P%                  VP&                  \,        4       VP/                  4        VP1                  4        V P                  \        V4      R4       V P                  \        W!4      R4       VP3                  4        \5        V4       R# )rt  ro  r   TFNr   )r   r7  r   rw  r   r   rn   rl  rp  r   
put_nowaitr   r-  r  r   ro   pyqueueFullr   r   TIMEOUT1TIMEOUT2TIMEOUT3r   r   r   r$   )rs   MAXSIZEr#   ru  rv  r  r   r{  s   &       r   test_put_TestQueue.test_puta  s   

7
+**,"jjl||>>*=>   

U+T2E3U;		!		!T		!T4 		!U		!UD! 	

5U+U3E3T:EII&"5#3#34
',,Q6$$S[[!4',,Qt<$$S[[!4',,
A6$$Z%7%7;',,Qh?$$S[[(;',,Qx@$$S[[!4',,QhG$$S[[(;  "U+T2E3U;		Er   c                    VP                  4        VP                  ^4       VP                  ^4       VP                  ^4       VP                  ^4       VP                  4        R# r   N)r   r   r   r   r#   ru  rv  s   &&&&r   	_test_get_TestQueue._test_get  sF    		!		!		!		!!r   c                   V P                  4       pV P                  4       pV P                  4       pV P                  V P                  WV3R 7      pRVn        VP                  4        V P                  \        V4      R4       VP                  4        VP                  4        \        P                  ! \        4       V P                  \        V4      R4       V P                  VP                  RR4      ^4       V P                  VP                  R4      ^4       V P                  VP                  ^R7      ^4       V P                  VP                  4       ^4       V P                  \        V4      R4       \        VP                  4      p\        VP                  4      pV P!                  \"        P$                  VR4       V P'                  VP(                  ^ 4       V P!                  \"        P$                  VRR4       V P'                  VP(                  ^ 4       V P!                  \"        P$                  V4       V P'                  VP(                  ^ 4       V P!                  \"        P$                  VR\*        4       V P'                  VP(                  \*        4       V P!                  \"        P$                  VR\,        4       V P'                  VP(                  ^ 4       V P!                  \"        P$                  V\.        R7       V P'                  VP(                  \.        4       VP1                  4        \3        V4       R# )r   TFNr   )r   r7  r   r  r   r   rn   rl  r   r   r   r-  r  r   
get_nowaitr   ro   r|  Emptyr   r   r~  r  r  r   r$   )rs   r#   ru  rv  r  r   r  s   &      r   test_get_TestQueue.test_get  sY   

**,"jjl||>>*=>   

U+T2  "

5U+U3 	4.24!,1-q1))+Q/U+T2EII&"5#3#34
'--e4$$S[[!4'--eT:$$S[[!4'--4$$Z%7%7;'--dH=$$S[[(;'--eX>$$S[[!4'--h?$$S[[(;		Er   c                N    \        ^
^4       F  pVP                  V4       K  	  R# 
   N)r  r   )r   r#   r  s   && r   
_test_fork_TestQueue._test_fork  s    r2AIIaL r   c                   V P                  4       p\        ^
4       F  pVP                  V4       K  	  \        P                  ! \
        4       V P                  V P                  V3R7      pRVn        VP                  4        \        ^4       F#  pV P                  VP                  4       V4       K%  	  V P                  \        P                  VP                  R4       VP                  4        \!        V4       R# )r  r   TFN)r   r  r   r   r-  r  r   r  r   r   rn   r   ro   r|  r  r   r$   )rs   r#   r  r   s   &   r   	test_fork_TestQueue.test_fork  s     

 rAIIaL  	

5 LLuhL?		 rAUYY[!, '--E:	Er   c                F   V P                  4       p V P                  VP                  4       ^ 4       VP                  ^4       V P                  VP                  4       ^4       VP                  ^4       V P                  VP                  4       ^4       VP                  4        V P                  VP                  4       ^4       VP                  4        V P                  VP                  4       ^ 4       \        V4       R#   \         d    T P	                  R4        Li ; i)r   zqsize method not implementedN)r   rn   rj  r   r   r   r   r$   rs   r   s   & r   
test_qsize_TestQueue.test_qsize  s    JJL	:QWWY* 	
aA&	aA&	A&	A&A # 	:MM89	:s    D D D c                    \        VP                  R 4       F-  p\        P                  ! \        4       VP                  4        K/  	  R # r   )r-  r   r   r-  r  	task_done)r   r   objs   && r   _test_task_done_TestQueue._test_task_done  s,    t$CJJuKKM %r   c                   V P                  4       p\        ^4       Uu. uF!  pV P                  V P                  V3R7      NK#  	  ppV F  pRVn        VP                  4        K  	  \        ^
4       F  pVP                  V4       K  	  VP                  4        V F  pVP                  R4       K  	  V F  pVP                  4        K  	  \        V4       R# u upi )rc   r   TN)	JoinableQueuer  r   r  r   r   r   r   r$   )rs   r#   r  workersr   s   &    r   test_task_done_TestQueue.test_task_done  s    ""$ "!H&$q <<t';';5(<K$ 	 & AAHGGI  rAIIaL  	

AIIdO  AFFH E#&s   'Cc           	        \         P                  ! 4       ;_uu_ 4        R p\        VR,           RRR7      ;_uu_ 4       pVP                  R4       RRR4       \        P
                  ! \        P                  ! 4       4      ;_uu_ 4         \        V4       RRR4       RRR4       R#   + '       g   i     L`; i  \        P                   d    T P                  R4        LMi ; i  + '       g   i     LY; i  + '       g   i     R# ; i)imported_by_an_imported_module.pyrQ  rB  rC  zif 1:
                    import multiprocessing

                    q = multiprocessing.Queue()
                    q.put('knock knock')
                    q.get(timeout=3)
                    q.close()
                    del q
                Nz?Probable regression on import lock contention; see Issue #22853)r   temp_cwdrI  writer   DirsOnSysPathrB   getcwd
__import__r|  r  rl   )rs   module_namerL  s   &  r   test_no_import_lock_contention)_TestQueue.test_no_import_lock_contention+  s    !!:KkE)3AAQ   B ,,RYY[993{+ : "!AA }} 3II 2 33 :9 "!!sX    C:B(	9C:	C'	B;C:(B83C:;&C$!C'	#C$$C'	'C72C::D	c                $   \         P                  ! 4       p\        P                  ! 4       pV P	                  \
        P                  VP                  R R4       \        P                  ! 4       V,
          pV P                  VR4       \        V4       R# )T皙?r   N)
r   r   r   r   ro   r|  r  r   r  r$   )rs   r   r   deltas   &   r   test_timeout_TestQueue.test_timeout@  sb    !!# '--e< 5( 	u-Ar   c                   V P                   R 8w  d+   V P                  RP                  V P                   4      4        ! R R\        4      p\        P
                  P                  4       ;_uu_ 4        V P                  4       pVP                  V! 4       4       VP                  R4       V P                  VP                  \
        P                  R7      4       \        V4       RRR4       \        P
                  P                  4       ;_uu_ 4        V P                  ^R7      pVP                  V! 4       4       VP                  R4        V P                  VP                  4       ^4       V P                  VP                  \
        P                  R7      4       V P                  VP!                  4       4       \        V4       RRR4       R#   + '       g   i     L; i  \         d     Li ; i  + '       g   i     R# ; i)r   r   c                   &   a  ] tR tRt o R tRtV tR# )F_TestQueue.test_queue_feeder_donot_stop_onexc.<locals>.NotSerializableiP  c                    \         hr   )rD   r   s   &r   r   Q_TestQueue.test_queue_feeder_donot_stop_onexc.<locals>.NotSerializable.__reduce__Q  s    $$r   r\   Nry   rz   r{   r|   r   r   r   r   s   @r   NotSerializabler  P  s     % %r   r  Tr   Nrz  )r   r   r   r  testr   captured_stderrr   r   r   r   r0  r$   rn   rj  r   ri  )rs   r  r   s   &  r   "test_queue_feeder_donot_stop_onexc-_TestQueue.test_queue_feeder_donot_stop_onexcK  s_   99#MM7>>tyyIJ	%f 	% \\))++

AEE/#$EE$KOOAEE'*?*?E@AN , \\))++ 

1
%AEE/#$EE$K  A.
 OOAEE'*?*?E@AOOAGGI&N ,+ ,+ '   ,++s>   1A2G:G3 G",AG3G	"G0-G3/G00G33H	c                  a V P                   R 8w  d+   V P                  RP                  V P                   4      4        ! R R\        4      o ! V3R lR\        P
                  P                  4      pS! 4       p\        P                  P                  4       ;_uu_ 4        V! \        P                  ! 4       R7      pVP                  V4       VP                  R4       V P                  VP                  \        P                  R7      4       R	R	R	4       V P                  VP                  4       V P                  VP                   4       R	#   + '       g   i     LH; i)
r   r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )K_TestQueue.test_queue_feeder_on_queue_feeder_error.<locals>.NotSerializableiq  zMock unserializable objectc                "    R V n         R V n        R# FN)reduce_was_called on_queue_feeder_error_was_calledr   s   &r   r   T_TestQueue.test_queue_feeder_on_queue_feeder_error.<locals>.NotSerializable.__init__s  s    ).&8=5r   c                    R V n         \        hr_  )r  rD   r   s   &r   r   V_TestQueue.test_queue_feeder_on_queue_feeder_error.<locals>.NotSerializable.__reduce__w  s    )-&$$r   )r  r  N)	ry   rz   r{   r|   r}   r   r   r   r   r   s   @r   r  r  q  s     ,>% %r   r  c                   <   <a  ] tR tRt o Rt]V3R l4       tRtV tR# )E_TestQueue.test_queue_feeder_on_queue_feeder_error.<locals>.SafeQueuei{  z1Queue with overloaded _on_queue_feeder_error hookc                n   < \        V \        4      '       d   \        VS4      '       d
   R Vn        R# R# R# TN)r   rD   r  )r<  r  r  s   &&r   _on_queue_feeder_error\_TestQueue.test_queue_feeder_on_queue_feeder_error.<locals>.SafeQueue._on_queue_feeder_error}  s/    q.11"388;?C8 9 2r   r\   N)	ry   rz   r{   r|   r}   r%  r  r   r   )r   r  s   @r   	SafeQueuer  {  s     C@ @r   r  )rv   Tr   N)r   r   r   r  r   r   r   r  r   r  get_contextr   r   r   r0  r  r  )rs   r  not_serializable_objr   r  s   &   @r   'test_queue_feeder_on_queue_feeder_error2_TestQueue.test_queue_feeder_on_queue_feeder_errork  s     99#MM7>>tyyIJ	%f 	%	@..44 	@  /0\\))++o99;<AEE&' EE$KOOAEE'*?*?E@A , 	,>>?,MMN ,+s   A.EE	c                @   \         P                  ! 4       \         P                  ! 4       3 FB  pVP                  4        VP	                  4        V P                  VP                  4       4       KD  	  \         P                  ! 4       \         P                  ! 4       3 Fk  pVP                  R 4       VP                  4        VP	                  4        V P                  \        R4      ;_uu_ 4        VP                  4        RRR4       Km  	  R#   + '       g   i     K  ; i)foo	is closedN)
r   r   r  r    r!   r   ri  r   assertRaisesRegexOSErrorr  s   & r   "test_closed_queue_empty_exceptions-_TestQueue.test_closed_queue_empty_exceptions  s    
 !&&(/*G*G*IIAGGIMMOOOAGGI& J
 !&&(/*G*G*IIAEE%LGGIMMO''==	 >=	 J >==s   -DDc                   \         P                  ! 4       \         P                  ! 4       3 F  pVP                  4        V P	                  \
        R 4      ;_uu_ 4        VP                  R4       RRR4       V P	                  \
        R 4      ;_uu_ 4        VP                  4        RRR4       K  	  R#   + '       g   i     LM; i  + '       g   i     K  ; i)r  r  N)r   r   r  r    r  rE   r   r   r  s   & r   $test_closed_queue_put_get_exceptions/_TestQueue.test_closed_queue_put_get_exceptions  s     &&(/*G*G*IIAGGI''
K@@e A''
K@@ A@	 J@@@@@s   B3C3CCr\   N)ry   rz   r{   r|   r"  rw  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   s   @r   rr  rr  W  s      " "9v " "3j  8   
,3*	@$OL" r   rr  c                      a  ] tR tRt o ]RR l4       t]R 4       tR tR t]	R 4       t
]P                  ! ]R4      R	 4       t]RR
 l4       tR tR t]P                  ! ]R4      R 4       tR tR tRtV tR# )	_TestLocki  Nc                f    V P                  4        Ve   VP                  \        V 4      4       R # R # r   )acquirer  repr)lockls   &&r   _acquire_TestLock._acquire  s%    =HHT$Z  r   c                r    V P                  4        VP                  4        \        P                  ! R 4       R# )      ?N)r  r   r   r-  )r  rV  s   &&r   _acquire_event_TestLock._acquire_event  s    		

3r   c                >   V P                   R 8w  d+   V P                  RP                  V P                   4      4       V P                  4       pV P	                  R\        V4      4       VP                  4        V P	                  R\        V4      4       VP                  4        Rp. p\        P                  ! V P                  W3VR7      pVP                  4        \        P                  ! R4       V P	                  RV R2V^ ,          4       VP                  4        \        P                  ! V P                  V3VR7      pVP                  4        \        P                  ! R4       V P	                  R	\        V4      4       VP                  4        R
p\        P                  ! 4       P!                  4       pV P#                  V P                  W3VR7      pVP                  4        VP%                  4        V P	                  RV R2V^ ,          4       V P                  4       pV P'                  4       pV P#                  V P(                  W3RR7      pVP                  4        VP+                  4        V P	                  R\        V4      4       VP-                  4        R# )r   r   z<Lock(owner=None)>z<Lock(owner=MainProcess)>T1r   rQ   r,   r   z<Lock(owner=MainProcess|)>z<Lock(owner=SomeOtherThread)>P1z<Lock(owner=P2z<Lock(owner=SomeOtherProcess)>N)r   r   r   Lockrn   r  r  releaserA  r  r  r   r   r-  r   Managerr   r   r   r7  r  r   r'  )rs   r  tnamer  r   pnamer   rV  s   &       r   test_repr_lock_TestLock.test_repr_lock  s   99#MM7>>tyyIJyy{-T
;4tDzBDMM#')"') 	
	

33E7"=qtDDMM#''"') 	
	

38$t*E##%**,LL#i#  % 	
		<wb11Q48yy{

LL 3 3#m"  $ 	
	

9DJG	r   c                   V P                  4       pV P                  VP                  4       R 4       V P                  VP	                  4       4       V P                  VP                  R4      R4       V P                  VP                  4       R4       V P                  VP	                  4       4       V P                  \        \        P                  3VP
                  4       R# )TFN)r  rn   r  r   lockedr  r   ro   rE   rA  ThreadErrorrs   r  s   & r   	test_lock_TestLock.test_lock  s    yy{.&e,e4.':y'<'<=t||Lr   c                p    VP                  4        VP                  4       Vn        VP                  4        R # r   )r  r  r   r   )r   r  rV  r   s   &&&&r   _test_lock_locked_2processes&_TestLock._test_lock_locked_2processes  s!    KKM			r   needs sharedctypesc                   V P                   R 8w  d+   V P                  RP                  V P                   4      4       V P                  4       pV P	                  4       pV P                  R^ 4      pV P                  V P                  WV3R7      pVP                  4        VP                  4        V P                  VP                  4       4       V P                  VP                  4       VP                  4        R# r   r   r   r   N)r   r   r   r  r7  r   r   r  r   r   r   r  r   r   )rs   r  rV  r   r   s   &    r   test_lock_locked_2processes%_TestLock.test_lock_locked_2processes  s    99#MM7>>tyyIJyy{

jja LL A A#C0  2		

&		"	r   c                    \        V4       F  pV P                  4        K  	  Ve   VP                  \        V 4      4       \        P
                  ! V4       \        V4       F  pV P                  4        K  	  R # r   )r  r  r  r  r   r-  r  )r  r5   r  n_s   &&&& r   _acquire_release_TestLock._acquire_release
  sQ    qALLN =HHT$Z 

7qALLN r   c                   V P                   R 8w  d+   V P                  RP                  V P                   4      4       V P                  4       pV P	                  R\        V4      4       ^p\        V4       F  pVP                  4        K  	  V P	                  RV R2\        V4      4       \        V4       F  pVP                  4        K  	  . . rT\        V4       F`  pVP                  \        P                  ! V P                  VRWV^,           3RV^,            2R7      4       VR,          P                  4        Kb  	  V F  pVP                  4        K  	  \        V4       F*  pV P                  RV^,            R	V^,            R2V4       K,  	  V P                  4       p\        P                  ! VP                  R
7      pVP                  4        VP                  4        V P	                  R\        V4      4       Rp	\         P"                  ! 4       P%                  4       pV P'                  V P                  VRV3V	R7      p
V
P                  4        V
P                  4        V P	                  RV	 R2V^ ,          4       V P                  4       pV P'                  V P(                  V3R7      p
V
P                  4        V
P                  4        V P	                  R\        V4      4       R# )r   r   z<RLock(None, 0)>z<RLock(MainProcess, r  r   Tr  z<RLock(MainProcess|Tz, r   z!<RLock(SomeOtherThread, nonzero)>r  z<RLock(z, 1)>r   z"<RLock(SomeOtherProcess, nonzero)>NrA   )r   r   r   RLockrn   r  r  r  r  r  rA  r  r	  r   r   rp   r   r  r   r   r  )rs   r  r  r  r   r  r  t_rlockr  r   s   &          r   test_repr_rlock_TestLock.test_repr_rlock  sL   99#MM7>>tyyIJzz|+T$Z8qALLN /s"5tDzBqALLN  21qAHHY%%T-B-B,0#qA#+>-.qse96 7 bEKKM	 
 BGGI qAMM01R!uB?C  

EMM2			<d5kJ##%**,LL 5 5#S!n#  % 	
		75'/16

LLUHL=			=tE{Kr   c                   V P                  4       pV P                  VP                  4       R 4       V P                  VP	                  4       4       V P                  VP                  4       R 4       V P                  VP                  4       R 4       V P                  VP                  4       R4       V P                  VP	                  4       4       V P                  VP                  4       R4       V P                  VP                  4       R4       V P                  VP	                  4       4       V P                  \        \        3VP
                  4       R# r  )
r  rn   r  r   r  r  r   ro   r&  rh  r  s   & r   
test_rlock_TestLock.test_rlockB  s    zz|.&...&..'><8$,,Gr   c                   V P                   R 8w  d+   V P                  RP                  V P                   4      4       V P                  4       pV P	                  4       pV P                  R^ 4      pV P                  V P                  WV3R7      pVP                  4        VP                  4        V P                  VP                  4       4       V P                  VP                  4       VP                  4        R# r  )r   r   r   r  r7  r   r   r  r   r   r   r  r   r   )rs   r  rV  r   r   s   &    r   test_rlock_locked_2processes&_TestLock.test_rlock_locked_2processesO  s    99#MM7>>tyyIJ



jja LL A A$S1  3		

'		"	r   c                    V P                  4       ;_uu_ 4       pV P                  V4       R R R 4       R #   + '       g   i     R # ; ir   )r  r   rs   r  s   & r   test_lock_context_TestLock.test_lock_context`  s'    YY[[FOOF# [[[	   5A	c                    V P                  4       ;_uu_ 4       pV P                  V4       R R R 4       R #   + '       g   i     R # ; ir   )r  r   r  s   & r   test_rlock_context_TestLock.test_rlock_contextd  s'    ZZ\\VOOF# \\\r  r\   r   )Nr   )ry   rz   r{   r|   r%  r  r  r  r  r"  r  rF   r#  HAS_SHAREDCTYPESr  r	  r  r  r  r  r  r   r   r   s   @r   r  r    s     ! !
  
.`M  
 )+?@ A  ,L\H )+?@ A $$ $r   r  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )_TestSemaphoreii  c                \   V P                  ^\        V4       V P                  VP                  4       R4       V P                  ^\        V4       V P                  VP                  4       R4       V P                  ^ \        V4       V P                  VP                  R4      R4       V P                  ^ \        V4       V P                  VP	                  4       R4       V P                  ^\        V4       V P                  VP	                  4       R4       V P                  ^\        V4       R# )r   TFN)r   r   rn   r  r  rs   sems   &&r   _test_semaphore_TestSemaphore._test_semaphorek  s    ''9c:-''9c:-''9c:U+U3''9c:-''9c:-''9c:r   c                &   V P                  ^4      pV P                  V4       V P                  VP                  4       R4       V P	                  ^\
        V4       V P                  VP                  4       R4       V P	                  ^\
        V4       R# r  )	Semaphorer&  rn   r  r   r   r$  s   & r   test_semaphore_TestSemaphore.test_semaphorex  sn    nnQS!-''9c:-''9c:r   c                J    V P                  ^4      pV P                  V4       R# r  )BoundedSemaphorer&  r$  s   & r   test_bounded_semaphore%_TestSemaphore.test_bounded_semaphore  s     ##A&S!r   c                    V P                   R 8w  d+   V P                  RP                  V P                   4      4       V P                  ^ 4      p\	        VP
                  4      pV P                  V! R4      R4       V P                  VP                  R4       V P                  V! RR4      R4       V P                  VP                  R4       V P                  V! R\        4      R4       V P                  VP                  ^ 4       V P                  V! R\        4      R4       V P                  VP                  \        4       V P                  V! \        R7      R4       V P                  VP                  \        4       R# )r   r   Fr3   NTr   )r   r   r   r)  r   r  rn   r   r   r~  r  r  )rs   r%  r  s   &  r   r  _TestSemaphore.test_timeout  s   99#MM7>>tyyIJnnQ,/$$W__c:-u5$$W__c:159$$W__a8x0%8$$W__h?2E:$$W__h?r   r\   N)
ry   rz   r{   r|   r&  r*  r.  r  r   r   r   s   @r   r"  r"  i  s      ;;"@ @r   r"  c                      a  ] tR tRt o ]RR l4       tR tR tR tR t	R t
R	 t]R
 4       t]P                  ! ]R4      R 4       t]R 4       t]P                  ! ]R4      R 4       t]R 4       tR tRtV tR# )_TestConditioni  Nc                    VP                  4        VP                  4        VP                  V4       VP                  4        VP                  4        R # r   )r  r  r   )r   condsleepingwokenr5   s   &&&&&r   rL  _TestCondition.f  s5    		'r   c                    \         P                  ! \         P                  4       F  p V! 4       V8X  d    MK  	  V P	                  W!4       R #   \         d      K"  i ; ir   )r   sleeping_retryr0  r   r   )rs   r   r   r  s   &&& r   assertReachesEventually&_TestCondition.assertReachesEventually  sW    ''(=(=>A6U? # ? 	''4 ' s   AAAc                <   V P                   R 8X  dy    VP                  P                  4       VP                  P                  4       ,
          pV P	                  V^ 4       V P	                  VP
                  P                  4       ^ 4       R# R#   \         d     R# i ; ir   N)r   _sleeping_countr   _woken_countrn   _wait_semaphorer   )rs   r5  sleeperss   && r   check_invariant_TestCondition.check_invariant  s    99# 00::< --779:  1-  !5!5!?!?!A1E $ ' s   A5B BBc                6  a V P                  4       pV P                  ^ 4      pV P                  ^ 4      oV P                  V P                  WS3R7      pRVn        VP                  4        \        P                  ! V P                  WS3R7      pRVn        VP                  4        VP                  4        VP                  4        V P                  V3R l^ 4       VP                  4        VP                  4        VP                  4        V P                  V3R l^4       VP                  4        VP                  4        VP                  4        V P                  V3R l^4       V P                  V4       \        P                  ! V4       \        V4       R# )r   r   Tc                     < \        S 4      # r   r   r7  s   r   <lambda>,_TestCondition.test_notify.<locals>.<lambda>  
    Yu-=r   c                     < \        S 4      # r   rG  rH  s   r   rI  rJ    rK  r   c                     < \        S 4      # r   rG  rH  s   r   rI  rJ    rK  r   N)	Conditionr)  r   rL  r   r   rA  r  r  r;  notifyr  rC  r	   r!   r'   )rs   r5  r6  r   r   r7  s   &    @r   test_notify_TestCondition.test_notify  s3   ~~>>!$q!LLde-DLE		DFF$%1HI		 	 	$$%=qA 	 	$$%=qA 	 	$$%=qA 	T"$$Q'Qr   c                   V P                  4       pV P                  ^ 4      pV P                  ^ 4      p. p\        ^4       F  pV P                  V P                  WV\
        3R7      pRVn        VP                  4        VP                  V4       \        P                  ! V P                  WV\
        3R7      pRVn        VP                  4        VP                  V4       K  	  \        ^4       F  pVP                  4        K  	  \        ^4       F  pVP                  4        K  	  V P                  ^ \        V4       V P                  V4       \        ^4       F  pV P                  V P                  WV3R7      pRVn        VP                  4        VP                  V4       \        P                  ! V P                  WV3R7      pRVn        VP                  4        VP                  V4       K  	  \        ^4       F  pVP                  4        K  	  \        P                   ! \"        4       V P                  ^ \        V4       VP                  4        VP%                  4        VP'                  4        \        ^4       F  pVP                  4        K  	  V P                  ^ \        V4       V P                  V4       V F  p\(        P*                  ! V4       K  	  R# )r   r   TN)rN  r)  r  r   rL  r~  r   r   r  rA  r  r  r   r   rC  r   r-  r  
notify_allr  r	   r!   )	rs   r5  r6  r7  r  r  r   r   rQ  s	   &        r   test_notify_all_TestCondition.test_notify_all  s>   ~~>>!$q! qADFF#'5("C  EAAHGGINN1  '+uh&GIAAHGGINN1  qA  qAMMO ''9e< 	T" qADFF$%1HIAAHGGINN1  de5LMAAHGGINN1  qA  	

5''9e< 	 qAMMO ''9e< 	T"A((+ r   c                r  a V P                  4       pV P                  ^ 4      pV P                  ^ 4      o. p\        ^4       F  pV P                  V P                  WS3R7      pRVn        VP                  4        VP                  V4       \        P                  ! V P                  WS3R7      pRVn        VP                  4        VP                  V4       K  	  \        ^4       F  pVP                  4        K  	  \        P                  ! \        4       V P                  ^ \        S4       VP                  4        VP!                  ^R7       VP#                  4        V P%                  V3R l^4       VP                  4        VP!                  ^R7       VP#                  4        V P%                  V3R l^4       VP                  4        VP!                  ^R7       VP#                  4        V P                  ^\        S4       V P'                  V4       V F  p\(        P*                  ! V4       K  	  R# )r   r   T)r  c                     < \        S 4      # r   rG  rH  s   r   rI  ._TestCondition.test_notify_n.<locals>.<lambda>M  rK  r   c                     < \        S 4      # r   rG  rH  s   r   rI  rX  T  rK  r   N)rN  r)  r  r   rL  r   r   r  rA  r  r  r   r-  r  r   r   rO  r  r;  rC  r	   r!   )	rs   r5  r6  r  r  r   r   rQ  r7  s	   &       @r   test_notify_n_TestCondition.test_notify_n-  s   ~~>>!$q! qADFF$%1HIAAHGGINN1  de5LMAAHGGINN1  qA  	

5''9e< 	a 	$$%=qA 	a$$%=qA 	a''9e< 	T"A((+ r   c                   V P                  4       p\        VP                  4      pVP                  4        V! \        4      pVP                  4        V P                  VR 4       V P                  VP                  \        4       R# r  )	rN  r   r   r  r~  r  rn   r   r   )rs   r5  r   r   s   &   r   r  _TestCondition.test_timeoutd  s[    ~~TYY'8ne$$$T\\8<r   c                  a T;_uu_ 4        ^ Sn         VP                  4        VP                  V3R l4      pV'       d   SP                   ^8w  d   \        P                  ! ^4       RRR4       R#   + '       g   i     R# ; i)r   c                  "   < S P                   ^8H  # rb   r   states   r   rI  0_TestCondition._test_waitfor_f.<locals>.<lambda>r      EKKNr   N)r   rO  wait_forr   r  )r   r5  rb  r  s   &&f r   _test_waitfor_f_TestCondition._test_waitfor_fm  sL    TEKKKM]]#:;FU[[A- TTTs   AA22B	r  c                  a V P                  4       pV P                  R R4      oV P                  V P                  VS3R7      pRVn        VP                  4        V;_uu_ 4        VP                  V3R l4      pV P                  V4       V P                  SP                  ^ 4       RRR4       \        ^4       FU  p\        P                  ! R4       V;_uu_ 4        S;P                  ^,          un	        VP                  4        RRR4       KW  	  \        V4       V P                  VP                  ^ 4       R#   + '       g   i     L; i  + '       g   i     K  ; i)r  r   Tc                  "   < S P                   ^ 8H  # )r   r`  ra  s   r   rI  -_TestCondition.test_waitfor.<locals>.<lambda>  rd  r   Nr  rA   )rN  r   r   rf  r   r   re  r   rn   r   r  r   r-  rO  r'   r   )rs   r5  r   r  r  rb  s   &    @r   test_waitfor_TestCondition.test_waitforv  s     ~~

3#LL 4 4D%=LI		T]]#:;FOOF#U[[!, 
 qAJJtq    	QQ' T s   $AD<*E<E	E c                L  a VP                  4        T;_uu_ 4        R p\        P                  ! 4       pVP                  V3R lVR7      p\        P                  ! 4       V,
          pV'       g   V\        ,
          V8:  d   RVn        RRR4       R#   + '       g   i     R# ; i)r   c                  "   < S P                   ^8H  # rb   r`  ra  s   r   rI  8_TestCondition._test_waitfor_timeout_f.<locals>.<lambda>  rd  r   r   TN)r  r   r   re  	CLOCK_RESr   )r   r5  rb  successr%  r  dtr  s   &&f&&   r   _test_waitfor_timeout_f&_TestCondition._test_waitfor_timeout_f  sh    TH!B]]#:H]MF!B&Bx)3: $ TTTs   A,BB#	c                   V P                  4       pV P                  R ^ 4      pV P                  R R4      pV P                  ^ 4      pV P                  V P                  WW43R7      pRVn        VP                  4        V P                  VP                  \        P                  R7      4       \        ^4       FU  p\        P                  ! R4       V;_uu_ 4        V;P                  ^,          un        VP                  4        RRR4       KW  	  \!        V4       V P                  VP                  4       R#   + '       g   i     K  ; i)r  Fr   Tr   r  N)rN  r   r)  r   rs  r   r   r   r  r   r%  r  r   r-  r   rO  r'   )rs   r5  rb  rq  r%  r   r  s   &      r   test_waitfor_timeout#_TestCondition.test_waitfor_timeout  s     ~~

3"**S%(nnQLL < <#G9  ;		G,@,@AB qAJJuq    	Q& s   *D77Ec                    V;_uu_ 4        VP                  4        R R R 4       \        P                  ! ^4       Ve(   \        P                  ! V\
        P                  4       R # R #   + '       g   i     LS; ir   )rO  r   r-  rB   r  rZ  r[  )r   r   r	  s   &&&r   _test_wait_result _TestCondition._test_wait_result  sD    QHHJ 

1?GGC'  Qs   A''A7	c                   \        V \        4      '       d,   \        P                  R 8w  d   \        P
                  ! 4       pMRpV P                  4       pT;_uu_ 4        V P                  VP                  ^ 4      4       V P                  VP                  R4      4       V P                  V P                  W!3R7      pVP                  4        V P                  VP                  ^<4      4       Ve"   V P                  \        VP                  ^<4       VP                  4        RRR4       R#   + '       g   i     R# ; i)r1   Nr   r   )r   ProcessesMixinr   r   rB   r   rN  r   r   r   ry  r   r   ro   KeyboardInterruptr   )rs   r	  r   r   s   &   r   test_wait_result_TestCondition.test_wait_result  s    dN++0G))+CCNNQQVVAY'QVVC[)D$:$:!JAGGIOOAFF2J'!!"3QVVR@FFH QQQs   CD,,D=	r\   r   )ry   rz   r{   r|   r"  rL  r;  rC  rP  rT  rZ  r  rf  rF   r#  r   rk  rs  rv  ry  r~  r   r   r   s   @r   r3  r3    s      5	(TC,J5,n=   )+?@( A(. % % )+?@' A'. ( ( r   r3  c                   H   a  ] tR tRt o ]R 4       tR tV 3R lR ltRtV t	R# )
_TestEventi  c                Z    \         P                  ! \        4       VP                  4        R # r   )r   r-  r  r   rU  s   &&r   _test_event_TestEvent._test_event  s    

8		r   c                ~   V P                  4       p\        VP                  4      pV P                  VP	                  4       R 4       V P                  V! R4      R 4       V P                  VP                  R4       V P                  V! \        4      R 4       V P                  VP                  \        4       VP                  4        V P                  VP	                  4       R4       V P                  V! 4       R4       V P                  VP                  R4       V P                  V! \        4      R4       V P                  VP                  R4       VP                  4        V P                  V P                  V3R7      pRVn        VP                  4        V P                  V! 4       R4       VP                  4        R# )Fr3   Tr   N)r7  r   r   rn   r  r   r   r~  r   r  r   r  r   r   r   )rs   rV  r   r   s   &   r   
test_event_TestEvent.test_event  sF   

UZZ( 	/ 	cE*$$T\\37h/$$T\\8<		 	.&$$T\\37h.$$T\\37 	 LL 0 0xL@		&	r   c                   < V ^8  d   QhRR/# )r   returnNr\   )r   r   s   "r   r   _TestEvent.__annotate__  s     W W4 Wr   c                   V P                  4       pV P                  R 8X  dt   V P                  \        V4      R4       VP	                  4        V P                  \        V4      R4       VP                  4        V P                  \        V4      R4       R# V P                  R8X  dI   V P                  \        V4      R4       VP	                  4        V P                  \        V4      R4       R# R# )r   z<Event at .* unset>z<Event at .* set>r   z(<EventProxy object, typeid 'Event' at .*N)r7  r   assertRegexr  r   r  )rs   rV  s   & r   	test_repr_TestEvent.test_repr  s    

99#T%[*@AIIKT%[*>?KKMT%[*@AYY)#T%[*UVIIKT%[*UV $r   r\   N)
ry   rz   r{   r|   r"  r  r  r  r   r   r   s   @r   r  r    s)      !FW Wr   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	
_DummyListi  c                    \         P                  P                  \        P                  ! R 4      4      p\         P
                  ! 4       pV P                  W34       ^ V P                  ^ &   R# r  N)r   heapBufferWrapperstructcalcsizer  __setstate__
_lengthbuf)rs   wrapperr  s   &  r   r   _DummyList.__init__  sM    !&&44V__S5IJ##%7/*r   c                    Vw  V n         V n        V P                   P                  4       P                  R 4      V n        R# r  )_wrapper_lockcreate_memoryviewcastr  )rs   rb  s   &&r   r  _DummyList.__setstate__  s/    &+#
--99;@@Er   c                2    V P                   V P                  3# r   )r  r  r   s   &r   __getstate___DummyList.__getstate__  s    tzz**r   c                    V P                   ;_uu_ 4        V P                  ^ ;;,          ^,          uu&   RRR4       R#   + '       g   i     R# ; ir   r  r  )rs   r  s   &&r   r  _DummyList.append  s+    ZZZOOA!# ZZZs	    ?A	c                    V P                   ;_uu_ 4        V P                  ^ ,          uuRRR4       #   + '       g   i     R# ; ir   r  r   s   &r   __len___DummyList.__len__!  s#    ZZZ??1% ZZZs	   3A	)r  r  r  N)ry   rz   r{   r|   r   r  r  r  r  r   r   r   s   @r   r  r    s$     F+$& &r   r  c                  2    \         P                  ! R 4       R# )r  NrP  r\   r   r   _waitr  %  s    JJtr   c                   L   a  ] tR tRt o RtRR ltR tR tR tR t	R t
R	tV tR
# )Bunchi*  z
A bunch of threads.
c                   W n         W0n        W@n        VP                  4       V n        VP                  4       V n        VP                  4       V n        V'       g   V P                  P                  4        . p\        V4       FG  pVP                  V P                  R7      pRVn        VP                  4        VP                  V4       KI  	  R p	\        P                   ! W	V4      V n        R# )z
Construct a bunch of `n` threads running the same function `f`.
If `wait_before_exit` is True, the threads won't terminate until
do_finish() is called.
r   Tc                 8    V  F  pVP                  4        K  	  R # r   )r   )r   r   s   & r   finalize Bunch.__init__.<locals>.finalizeD  s     r   N)rL  rQ   r  	DummyListstartedfinishedr7  	_can_exitr   r  r   taskr   r   r  r  r  
_finalizer)
rs   	namespacerL  rQ   r  wait_before_exitr   r  r   r  s
   &&&&&&    r   r   Bunch.__init__.  s     	 **,!++-"*NN qA!!!3AAHGGINN1	 	 "**47Cr   c                ~   \         P                  ! 4       pV P                  P                  V4        V P                  ! V P
                  !   V P                  P                  V4       V P                  P                  ^4       R#   T P                  P                  T4       T P                  P                  ^4       i ; i)   N)	rB   r   r  r  rL  rQ   r  r  r   rs   r	  s   & r   r  
Bunch.taskJ  s    iikC 	+FFDIIMM  %NN# MM  %NN#s   B 8B<c                f    \        V P                  4      V P                  8  d   \        4        K0  R # r   )r   r  r  r  r   s   &r   wait_for_startedBunch.wait_for_startedT  s!    $,,$&&(G )r   c                f    \        V P                  4      V P                  8  d   \        4        K0  R # r   )r   r  r  r  r   s   &r   wait_for_finishedBunch.wait_for_finishedX  s!    $-- 466)G *r   c                :    V P                   P                  4        R # r   )r  r   r   s   &r   	do_finishBunch.do_finish\  s    r   c                &    V P                  4        R # r   )r  r   s   &r   r    Bunch.close_  s    r   )r  r  rQ   rL  r  r  r  Nr`  )ry   rz   r{   r|   r}   r   r  r  r  r  r    r   r   r   s   @r   r  r  *  s.     D8+ r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )
AppendTrueic  c                    Wn         R # r   r  )rs   r  s   &&r   r   AppendTrue.__init__d  s    r   c                <    V P                   P                  R 4       R# r  )r  r  r   s   &r   r   AppendTrue.__call__f  s    r   r  Nr   r   s   @r   r  r  c  s      r   r  c                     a  ] tR tRt o Rt^tRtR tR tR t	R t
]R 4       tRR	 ltR
 t]R 4       tR t]R 4       tR t]R 4       tR t]R 4       tR t]R 4       tR t]R 4       tR t]R 4       tR tR t]R 4       tR tRt V t!R# )_TestBarrierij  z
Tests for Barrier objects.
g      >@c                ^    V P                  V P                  V P                  R 7      V n        R# )r   N)Barrierr  defaultTimeoutbarrierr   s   &r   setUp_TestBarrier.setUpq  s     ||DFFD4G4G|Hr   c                H    V P                   P                  4        R V n         R # r   )r  abortr   s   &r   tearDown_TestBarrier.tearDownt  s    r   c                    V P                   R 8X  d   . # V P                   R8X  d   V P                  P                  4       # \        4       # )r   r   )r   r   r   r  r   s   &r   r  _TestBarrier.DummyListx  s:    99	!IYY)#<<$$&&<r   c                    \        WW P                  ^,
          4      p V! V!   VP                  4        VP                  4        R#   TP                  4        i ; ir   )r  r  r  r    )rs   rL  rQ   r   s   &&& r   run_threads_TestBarrier.run_threads  sA    $4*	tH!GGIAGGIs   A Ac                   VP                   p\        V4       FS  pV^ ,          P                  R4       VP                  4        V^,          P                  R4       VP                  4        KU  	  R#   \         d     R# i ; i)r   TN)partiesr  r  r   r   )r   r  resultsr  mr  s   &&&&  r   	multipass_TestBarrier.multipass  sf    OOqAAJd#LLNAJd#LLN 	" 		s   1B ?B c                    V P                  4       V P                  4       .pV P                  V P                  V P                  W!34       R# )z+
Test that a barrier is passed in lockstep
N)r  r  r  r  )rs   passesr  s   && r   test_barrier_TestBarrier.test_barrier  s9     >>#T^^%56$,,)HIr   c                $    V P                  ^
4      # )z3
Test that a barrier works for 10 consecutive runs
)r  r   s   &r   test_barrier_10_TestBarrier.test_barrier_10  s       $$r   c                H    VP                  4       pVP                  V4       R # r   )r   r   )r   r  r#   r   s   &&& r   _test_wait_return_f _TestBarrier._test_wait_return_f  s    lln		#r   c                :   V P                  4       pV P                  V P                  V P                  V34       \	        V P
                  4       Uu. uF  q!P                  4       NK  	  ppV P                  VP                  ^ 4      ^4       \        V4       R# u upi )z)
test the return value from barrier.wait
N)
r   r  r  r  r  r  r   rn   countr$   )rs   r#   r  r  s   &   r   test_wait_return_TestBarrier.test_wait_return  st     

11DLL%3HI(-dff6199;6q)1-E 7s   Bc                R    VP                  4        \        V4      ^8w  d   \        hR# r   )r   r   rh  )r   r  r  s   &&&r   _test_action_f_TestBarrier._test_action_f  s"    w<1 r   c                    V P                  4       pV P                  V P                  \        V4      R7      pV P	                  V P
                  W!34       V P                  \        V4      ^4       R# )z
Test the 'action' callback
)r  N)r  r  r  r  r  r  rn   r   )rs   r  r  s   &  r   test_action_TestBarrier.test_action  sX     ..",,tvvj.A,B,,w.@AWq)r   c                8    VP                  4       pW@P                  ^,          8X  d   \        hVP                  4        VP                  R4       R#   \        P
                   d    TP                  R4        R# \         d    TP                  4         R# i ; ir   TN)r   r  rh  r  rA  BrokenBarrierErrorr  )r   r  results1results2r  s   &&&& r   _test_abort_f_TestBarrier._test_abort_f  sl    		AEE1H}""LLNOOD!++ 	"OOD! 	MMO	s   AA &B;BBBc                n   V P                  4       pV P                  4       pV P                  V P                  V P                  W34       V P	                  \        V4      ^ 4       V P	                  \        V4      V P                  ^,
          4       V P                  V P                  P                  4       R# )z;
Test that an abort will put the barrier in a broken state
N)	r  r  r  r  rn   r   r  r   broken)rs   r  r   s   &  r   
test_abort_TestBarrier.test_abort  s     >>#>>#++,,;	=X*Xq1++,r   c                   VP                  4       pWPP                  ^,          8X  dL   VP                  V P                  ^,
          8  d   \        P                  ! R4       K:  VP                  4        M" VP                  4        VP                  R4       VP                  4        VP                  R4       R#   \        P                   d    TP                  R4        LKi ; i)r   r  TN)	r   r  	n_waitingr   r-  resetr  rA  r  )r   r  r  r   results3r  s   &&&&& r   _test_reset_f_TestBarrier._test_reset_f  s    LLNq=##ceeAg-

5!MMO&% 		 // &%&s   4!B8 8&C! C!c                   V P                  4       pV P                  4       pV P                  4       pV P                  V P                  V P                  WV34       V P	                  \        V4      ^ 4       V P	                  \        V4      V P                  ^,
          4       V P	                  \        V4      V P                  4       R# )z<
Test that a 'reset' on a barrier frees the waiting threads
N)r  r  r  r  rn   r   r  )rs   r  r   r
  s   &   r   
test_reset_TestBarrier.test_reset  s     >>#>>#>>#++,,HE	GX*Xq1X/r   c                    VP                  4       pW`P                  ^,          8X  d   \        hVP                  4        VP                  R4       VP                  4       V P                  ^,          8X  d   VP                  4        VP                  4        VP                  4        VP                  R4       R#   \        P
                   d    TP                  R4        L\         d    TP                  4         Li ; ir  )r   r  rh  r  rA  r  r  r	  )r   r  barrier2r  r   r
  r  s   &&&&&& r   _test_abort_and_reset_f$_TestBarrier._test_abort_and_reset_f  s    		AEE1H}""LLNOOD! ==?ceeQh&MMO ++ 	"OOD! 	MMO	s   AB9 9&C>!C>*C>=C>c                   V P                  4       pV P                  4       pV P                  4       pV P                  V P                  4      pV P                  V P                  V P
                  WAW#34       V P                  \        V4      ^ 4       V P                  \        V4      V P                  ^,
          4       V P                  \        V4      V P                  4       R# )z6
Test that a barrier can be reset after being broken.
N)r  r  r  r  r  r  rn   r   )rs   r  r   r
  r  s   &    r   test_abort_and_reset!_TestBarrier.test_abort_and_reset	  s     >>#>>#>>#<<'55,,HO	QX*Xq1X/r   c                    VP                  4       pW0P                  ^,          8X  d   \        P                  ! R4        VP                  R4       R#   \        P
                   d    TP                  R4        R# i ; i)r   r  r  TN)r   r  r   r-  rA  r  r  r   r  r  r  s   &&& r   _test_timeout_f_TestBarrier._test_timeout_f!	  sW    LLNq=JJsO	!LL++ 	!NN4 	!s   A &A<;A<c                    V P                  4       pV P                  V P                  V P                  V34       V P	                  \        V4      V P                  P                  4       R# )z
Test wait(timeout)
N)r  r  r  r  rn   r   r  )rs   r  s   & r   r  _TestBarrier.test_timeout,	  sM     .."--g/FGWt||';';<r   c                   VP                  V P                  4      pW0P                  ^,          8X  d   \        P                  ! R4        VP                  4        R#   \
        P                   d    TP                  R4        R# i ; i)r   r  TN)r   r  r  r   r-  rA  r  r  r  s   &&& r   _test_default_timeout_f$_TestBarrier._test_default_timeout_f4	  s]    LL++,q=JJsO	!LLN++ 	!NN4 	!s   
A &BBc                    V P                  V P                  RR7      pV P                  4       pV P                  V P                  W34       V P                  \        V4      VP                  4       R# )z$
Test the barrier's default timeout
r  r   N)r  r  r  r  r  rn   r   r  )rs   r  r  s   &  r   test_default_timeout!_TestBarrier.test_default_timeout?	  sW     ,,tvvs,3.."557IJWw7r   c                h    V P                  ^4      pVP                  4        VP                  4        R# r   )r  r   )rs   r   s   & r   test_single_thread_TestBarrier.test_single_threadH	  s!    LLO		r   c                    \        V4       F7  pVP                  4        V;_uu_ 4        VP                  V4       R R R 4       K9  	  R #   + '       g   i     KN  ; ir   )r  r   r  )r   r  r  connr  r  s   &&&&& r   _test_thousand_f_TestBarrier._test_thousand_fM	  s8    vALLN		!  s   A		Ac                D   V P                   R 8X  d+   V P                  RP                  V P                   4      4       RpV P                  4       pV P	                  R4      w  r4\        V P                  4       FX  pV P                  V P                  V P                  WV3R7      pVP                  4        V P                  VP                  4       KZ  	  \        V4       F?  p\        V P                  4       F#  pV P                  VP                  4       V4       K%  	  KA  	  R# )r   r     Fr   N)r   r   r   r  r  r  r  r   r(  r  r   r  r   rn   r  )rs   r  r  r'  r)  jr   r  s   &       r   test_thousand_TestBarrier.test_thousandT	  s    99	!MM7>>tyyIJyy{99U+tvvAD$9$9!%v4 H  JAGGIOOAFF#	  vA466]  a0 # r   )r  Nr   )"ry   rz   r{   r|   r}   r  r  r  r  r  r  r"  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r!  r$  r(  r-  r   r   r   s   @r   r  r  j  s     	
ANI  " " J%    
* 
 

-  "0  *0 ! != ! !8
  1 1r   r  c            	       |   a  ] tR tRt o RtRRRRR]! R4      ]! R4      3.tR t]R 4       t	RR lt
R tR	 tR
tV tR# )
_TestValueih	  r   xyc                D    \         '       g   V P                  R 4       R# R# z%requires multiprocessing.sharedctypesNr   r   r   s   &r   r  _TestValue.setUpt	      MMAB  r   c                ^    \        WP                  4       F  w  r#V^,          Vn        K  	  R# r  )zipcodes_valuesr   )r   valuessvcvs   &&  r   r  _TestValue._testx	  s$    &"2"23FB!uBH 4r   c           	        V'       d3   V P                    UUUu. uF  w  r#pV P                  W#4      NK  	  ppppM1V P                    UUUu. uF  w  r#pV P                  W#4      NK  	  pppp\        WPP                   4       F(  w  rgV P	                  VP
                  V^,          4       K*  	  V P                  V P                  V3R7      pRVn        VP                  4        VP                  4        \        WPP                   4       F(  w  rgV P	                  VP
                  V^,          4       K*  	  R# u upppi u upppi )r   r   TN)r:  RawValuer   r9  rn   r   r   r  r   r   r   )	rs   rawcoder   r  r;  r<  r=  r  s	   &&       r   
test_value_TestValue.test_value~	  s   ,0,=,=?,=.$q mmD0,=  ?F -1,=,=?,=.$q jj-,=  ? &"3"34FBRXXr!u- 5 ||4::VI|>

		&"3"34FBRXXr!u- 5??s   D5D<c                *    V P                  R R7       R# T)rA  N)rC  r   s   &r   test_rawvalue_TestValue.test_rawvalue	  s    D!r   c                   V P                  R ^4      pVP                  4       pVP                  4       pV P                  R ^RR7      pVP                  4       pVP                  4       pV P                  4       pV P                  R ^VR7      pVP                  4       p	VP                  4       p
V P	                  Wy4       V P                  R ^RR7      pV P                  VR4       V P                  VR4       V P                  \        V P                   R ^RR7       V P                  R ^4      pV P                  VR4       V P                  VR4       R# )r  Nr  Fget_lockget_objnavalue)	r   rK  rL  r  rn   assertNotHasAttrro   rD   r@  )rs   val1lock1obj1val2lock2obj2r  val3lock3obj3arr4arr5s   &            r   test_getobj_getlock_TestValue.test_getobj_getlock	  s   zz#q!||~zz#qtz,||~yy{zz#qtz,||~%zz#quz-dJ/dI..$**c19M}}S!$dJ/dI.r   r\   Nrg  )r  i  i^  )dg      @g      )hi   )r                   r`  )ry   rz   r{   r|   r   r   r:  r  r"  r  rC  rG  rZ  r   r   r   s   @r   r0  r0  h	  s_     "M 		eCj%*%
LC  
.&"/ /r   r0  c                     a  ] tR tRt o R
t]R 4       t]P                  ! ]	RJ R4      RR l4       t
]P                  ! ]	RJ R4      R 4       t]P                  ! ]	RJ R4      R 4       t]P                  ! ]	RJ R4      R 4       tR	tV tR# )
_TestArrayi	  c                    \        ^\        V4      4       F$  pW;;,          W^,
          ,          ,          uu&   K&  	  R# r   )r  r   )r   seqr  s   && r   rL  _TestArray.f	  s)    q#c(#AFcA#hF $r   Nzrequires _ctypesc                   . ROpV'       d   V P                  RV4      pMV P                  RV4      pV P                  \        V4      \        V4      4       V P                  V^,          V^,          4       V P                  \	        VR,          4      \	        VR,          4      4       \
        P
                  ! R. R	O4      ;VR&   VR&   V P                  \	        VR,          4      V4       V P                  V4       V P                  V P                  V3R7      pRVn        VP                  4        VP                  4        V P                  \	        VR,          4      V4       R# )
  r  :r      N:rc   ra  NNNNr   TN)
rg  ir  i  i5        i$  i  i  i?  )r   r   r^  rc   )RawArrayArrayrn   r   r   arrayrL  r   r   r   r   )rs   rA  rd  arrr   s   &&   r   
test_array_TestArray.test_array	  s   @--S)C**S#&CS3s8,QQ(c#hc#h8#kk#|<<C3s8c!fs+sLLcVL4			c!fs+r   c           	     F   ^
p\        ^4       F  pV P                  RV4      pV P                  \        V4      V4       V P                  \	        V4      ^ .V,          4       \        ^
4      VR&   V P                  \	        V4      \	        \        ^
4      4      4       ?K  	  R# )r  r  ri  N)r  rm  rn   r   r   )rs   sizer  ro  s   &   r   test_array_from_size_TestArray.test_array_from_size	  s    
 qA**S$'CSXt,T#Yd
32YCFT#YU2Y8 r   c                *    V P                  R R7       R# rF  )rp  r   s   &r   test_rawarray_TestArray.test_rawarray	  s    D!r   c                B   V P                  R \        \        ^
4      4      4      pVP                  4       pVP	                  4       pV P                  R \        \        ^
4      4      RR7      pVP                  4       pVP	                  4       pV P                  4       pV P                  R \        \        ^
4      4      VR7      pVP                  4       p	VP	                  4       p
V P                  Wy4       V P                  R \        ^
4      RR7      pV P                  VR4       V P                  VR4       V P                  \        V P                   R \        ^
4      RR7       V P                  R \        ^
4      4      pV P                  VR4       V P                  VR4       R# )r  NrJ  FrK  rL  notalock)rm  r   r  rK  rL  r  rn   rN  ro   rD   rl  )rs   arr1rP  rQ  arr2rS  rT  r  arr3rV  rW  rX  rY  s   &            r   test_getobj_getlock_obj"_TestArray.test_getobj_getlock_obj	  sB   zz#tE"I/||~zz#tE"ITz:||~yy{zz#tE"ITz:||~%zz#uRyuz5dJ/dI..**c59: 	 	G }}S%),dJ/dI.r   r\   rg  r`  )ry   rz   r{   r|   r   r"  rL  rF   r~   r<   rp  rt  rw  r~  r   r   r   s   @r   rb  rb  	  s     "M  __Ud]$67, 8,0 __Ud]$67 8 __Ud]$67" 8" __Ud]$67/ 8/r   rb  c                   `   a  ] tR tRt o RtR tR tR tR tR t	R t
R tR	 tR
 tR tRtV tR# )_TestContainersi
  c                   V P                  \        \        ^
4      4      4      pV P                  VR,          \        \        ^
4      4      4       V P                  4       pV P                  VR,          . 4       VP                  \        \        ^4      4      4       V P                  VR,          \        \        ^4      4      4       V P                  V^,          ^4       V P                  VR,          . RO4       V^,          pV P                  VR,          . RO4       V P                  V^^.,           . RO4       V P                  VR,          \        \        ^
4      4      4       W.pV P                  V4      pT P                  V Uu. uF  qUR,          NK  	  up. RO. RO.4       V P                  V.4      pVP	                  R4       V P                  V^ ,          R,          . R	O4       R# u upi )
r  ri  :r   r  Nr3  N)r   r^  rc   )
r   r   r   r^  rc   r   r   r   r^  rc   )r   r   r   r^  rc   r   r   r   r^  rc   r   rt  )
r   r   r   r^  rc   r   rt  rh  ra  	   )r   r   r   r^  rc   r   rt  rh  ra  r  r3  )r   r  rn   extendr  )rs   r   r   r\  r<  elementrL  s   &      r   	test_list_TestContainers.test_list
  sz   IId59o&1tE"I/IIK1r"	eAh 1tE!H~.1q!4'*	Q1=>aV%IJ1tE"I/FIIaL'()qGQZZq)+-KL	
 IIqcN	1a"IJ *s   	G/c                D   V P                  4       pV P                  V\        P                  P                  4       RpV FI  pV P                  VR7      ;_uu_ 4        V P                  \        \        W4      4      4       RRR4       KK  	  R#   + '       g   i     K`  ; i)__contains__r,   N)r  __delitem____getitem____iadd__r  __reversed____setitem__r  r  r  r  indexinsertpopr  reverse)	r   r   collectionsabcMutableSequencer   r   callabler  )rs   r   mutable_sequence_methodsr,   s   &   r   test_list_isinstance$_TestContainers.test_list_isinstance$
  st    IIKa!@!@A
$
  -D4(()9 :; )( -(((   $BBc                H   V P                  \        \        ^
4      4      4      p\        V4      pV P                  \        V4      \        \        ^
4      4      4       V P                  \        V4      . 4       \        V4      p^dV^ &   V P                  \	        V4      ^d4       R# r  )r   r  r-  rn   next)rs   r   its   &  r   test_list_iter_TestContainers.test_list_iter5
  sw    IId59o&!Wb4b	?3b2&!W!b3'r   c           
        T P                  \        ^4       Uu. uF  qP                  \        ^4      4      NK  	  up4      pT P                  V Uu. uF  q3R,          NK  	  up. RO.^,          4       ^7V^ ,          R&   V P                  V^ ,          R,          . RO4       \        ^^4       F$  pV P                  W$,          R,          . RO4       K&  	  V P                  V^,          P                  4       ^4       V P                  \	        V^,          4      ^4       \        ^ ^^4       F$  pV P                  \	        W$,          4      ^4       K&  	  ?V P                  4       pVP                  V4       ?R# u upi u upi )r^  ri  N)r   r   r   rA   )r   r   7   )r   r  rn   r  r   r  )rs   _ir   innerr  r   s   &     r   test_list_proxy_in_list'_TestContainers.test_list_proxy_in_list?
  s$   IIU1X>Xryyq*X>?2u((2YK!OD!R1a*-q!AQT!Wi0  	1Q'QqTA&q!QASY*   IIK	# ?2s   "E9E>c           
     L   V P                  4       p\        \        ^A^F4      4      pV F  p\        V4      W&   K  	  V P	                  VP                  4       \        R V 4       4      4       V P	                  \        VP                  4       4      V4       T P	                  \        VP                  4       4      V Uu. uF  p\        V4      NK  	  up4       T P	                  \        VP                  4       4      V Uu. uF  q3\        V4      3NK  	  up4       R# u upi u upi )A   c              3   :   "   T F  q\        V4      3x  K  	  R # 5ir   )chr.0r  s   & r   	<genexpr>,_TestContainers.test_dict.<locals>.<genexpr>X
  s     'EWCFWs   N)
dictr   r  r  rn   r   sortedkeysr;  r  )rs   r\  indicesr  s   &   r   	test_dict_TestContainers.test_dictS
  s    IIKuR}%Aq6AD 4'EW'E#EF)73
+g-Fgc!fg-FG	*',J'QQ[',JK .G,Js   <D
>D!
c                D   V P                  4       pV P                  V\        P                  P                  4       RpV FI  pV P                  VR7      ;_uu_ 4        V P                  \        \        W4      4      4       RRR4       KK  	  R#   + '       g   i     K`  ; i)r  r  N)r  r  __eq__r  __iter__r  __ne__r  r  r   r  r  r  popitem
setdefaultupdater;  )	r  r   r  r  MutableMappingr   r   r  r  )rs   r   mutable_mapping_methodsr,   s   &   r   test_dict_isinstance$_TestContainers.test_dict_isinstance]
  st    IIKa!?!?@#

 ,D4(()9 :; )( ,(((r  c                j   V P                  4       p\        \        ^A^F4      4      pV F  p\        V4      W&   K  	  \	        V4      pV P                  \        V4      V4       V P                  \        V4      . 4       \	        V4      pVP                  4        V P                  \        \        V4       R# )r  N)
r  r   r  r  r-  rn   r  ro   rh  r  )rs   r\  r  r  r  s   &    r   test_dict_iter_TestContainers.test_dict_iterj
  s    IIKuR}%Aq6AD !Wb7+b2&!W		,b1r   c                   V P                  ^^R7      pV P                  ^
^R7      pV P                  WR7      pV P                  VR,          ^
4       V P                  VR,          R,          ^
4       ^VR,          R&   V P                  VR,          ^4       V P                  VR,          R,          ^4       ^VR,          R&   V P                  VR,          ^4       V P                  VR,          R,          ^4       ??V P                  VR,          R,          ^4       ^VR,          R&   V P                  VR,          R,          ^4       VR,          pVR,          p^VR&   V P                  VR,          ^4       V P                  VR,          R,          ^4       VP                  4        V P                  \        V4      ^ 4       V P                  VR,          ^4       V P                  VR	,          ^4       V P	                  W.4      p^V^ ,          R
&   V P                  VR
,          ^4       V P                  V^ ,          R
,          ^4       ??V P                  V^ ,          R
,          ^4       V P	                  ^X^c.V.4      pV P                  V^ ,          \        4       V P                  VR,          R,          R,          ^4       R# )r   )ferretshamsters)waterfeed)petssuppliesr  r  blanketsr  r  r  marmotsr  NrA   )r  rn   r  r   r   r   )rs   r  r  r\  r  outers   &     r   test_dict_proxy_nested&_TestContainers.test_dict_proxy_nestedw
  sb   yyQy/992A9.II4I3'*B/:w/4$%*j!*-q1:z2A6!"*g'*A.:w/369-q1$&*j!:z2B7yZ='*A.:w/3		Q#'*A.j)1-IIt&'!Yi!,1i!,1i!,		B8Q-(eAh-r2v.2r   c                   V P                  4       pVP                  V P                  4       4       V^ ,          P                  ^{4       V P	                  V^ ,          P                  4       ^{4       V P                  4       pV P                  4       V^ &   V^ ,          P                  R4       V P	                  V^ ,          P                  4       R4       R# )r     N)r   r  r   r   rn   r   r  r   s   &  r   test_nested_queue!_TestContainers.test_nested_queue
  s    IIK		!1S)IIKzz|!	!1S)r   c                "   V P                  4       pR Vn        RVn        RVn        V P	                  VP                  VP                  3R4       V=V P	                  \        V4      R4       V P                  VR4       V P                  VR4       R# )BobBuilderhiddenzNamespace(name='Bob')r,   jobN)r  r  )	Namespacer,   r  _hiddenrn   rq   assertHasAttrrN  )rs   r  s   & r   test_namespace_TestContainers.test_namespace
  sz    NN	!&&!%%*<=EQ!891f%a'r   r\   Nr   )ry   rz   r{   r|   r   r  r  r  r  r  r  r  r  r  r  r   r   r   s   @r   r  r  
  sD      MK><"((L<2,3\*	( 	(r   r  c                 x    Vf   \         P                  ! V4       W ,          # VP                  V4       W ,          # r   )r   r-  r   )r1  r   rV  s   &&&r   sqrr  
  s1    }

4 3J 	

43Jr   c                     W,          # r   r\   )r1  r2  s   &&r   mulr  
  	    3Jr   c                 R    \         P                  ! V 4       \        R R,          4      h)r1  i   )r   r-  rE   r   s   &r   raise_large_valuerrorr  
  s    JJt
S7]
##r   c                     V # r   r\   r1  s   &r   identityr  
  s    Hr   c                   0   a  ] tR tRt o ^ tR tR tRtV tR# )CountedObjecti
  c                ^    V ;P                   ^,          un         \        P                  V 4      # r   )n_instancesr  __new__rQ  s   &r   r  CountedObject.__new__
  s    1~~c""r   c                J    \        V 4      ;P                  ^,          un        R# r   )r;  r  r   s   &r   __del__CountedObject.__del__
  s    T
!#r   r\   N)	ry   rz   r{   r|   r  r  r  r   r   r   s   @r   r  r  
  s     K#$ $r   r  c                       ] tR tRtRtR# )SayWhenErrori
  r\   Nry   rz   r{   r|   r   r\   r   r   r  r  
  s    r   r  c              #      "   VR8X  d   \        R4      h\        V 4       F  pW!8X  d   \        R4      hVx  K  	  R# 5i)r   zSomebody said whenNrA   )r  r  )totalwhenr  s   && r   exception_throwing_generatorr  
  s<     rz/005\9344 s   <>c                     a a ] tR tRt o]V 3R l4       t]V 3R l4       tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR t]R 4       tR t]R 4       tR tR tR tR t R t!Rt"Vt#V ;t$# ) 	_TestPooli
  c                P   < \         SV `  4        V P                  ^4      V n        R# )rc   N)super
setUpClassPoolpoolr   	__class__s   &r   r  _TestPool.setUpClass
  s    88A;r   c                   < V P                   P                  4        V P                   P                  4        R V n         \        SV `  4        R # r   )r  r'  r   r  tearDownClassr  s   &r   r  _TestPool.tearDownClass
  s2    r   c                    V P                   P                  pV P                  V! \        R4      \        ^4      4       V P                  V! \        RR^/4      \        ^R7      4       R# )r   r1  r  N)r   r\   )r  applyrn   r  )rs   papplys   & r   
test_apply_TestPool.test_apply
  sK    T*CF3R#a138<r   c                   V P                   P                  pV P                  V! \        \	        \        ^
4      4      4      \	        \        \        \	        \        ^
4      4      4      4      4       V P                  V! \        \	        \        ^d4      4      ^R7      \	        \        \        \	        \        ^d4      4      4      4      4       R# )r  	chunksizeN)r  maprn   r  r   r  )rs   pmaps   & r   test_map_TestPool.test_map
  s|    yy}}c4b	?3T#c4b	?:S5TUc4c
#3rBc#tE#J'789	;r   c           
        V P                   P                  p\        \        \	        ^
4      \	        ^	RR4      4      4      pV P                  V! \        V4      \        \        P                  ! \        V4      4      4       \        \        \	        ^d4      \	        ^cRR4      4      4      pV P                  V! \        V^R7      \        \        P                  ! \        V4      4      4       R# )r  r  NrA   )r  starmapr   r9  r  rn   r  r   )rs   psmaptupless   &  r   test_starmap_TestPool.test_starmap
  s    		!!c%)U1R_56sF+i//V<=	?c%*eBr2&678sFb9i//V<=	?r   c           
        \        \        \        ^d4      \        ^cRR4      4      4      pV P                  V P                  P                  \        V4      P                  4       \        \        P                  ! \        V4      4      4       R# )rO  NrA   )
r   r9  r  rn   r  starmap_asyncr  r   r   r  )rs   r  s   & r   test_starmap_async_TestPool.test_starmap_async  s_    c%*eBr2&67800f=AACi//V<=	?r   c                    V P                  V P                  P                  \        \	        \        ^
4      4      4      P                  4       \	        \        \        \	        \        ^
4      4      4      4      4       R# r  )rn   r  	map_asyncr  r   r  r   r  r   s   &r   test_map_async_TestPool.test_map_async  sK    ,,S$uRy/BFFHc#tE"I78	:r   c                R   V P                   R 8X  d   V P                  P                  4       M. pV P                  P	                  \
        R.VP                  VP                  R7      P                  4        V P                  ^\        V4      4       V P                  ^.V^ ,          4       V P                  P	                  \
        R.VP                  VP                  R7      P                  4        V P                  ^\        V4      4       V P                  V^,          \        4       R# )r   1)callbackerror_callbackr   N)r   r   r   r  r  r  r  r   rn   r   r   rE   )rs   	call_argss   & r   test_map_async_callbacks"_TestPool.test_map_async_callbacks  s    +/99	+ADLL%%'r			C#%.%5%5+4+;+; 	 	==ATVC	N+!il+		C#%.%5%5+4+;+; 	 	==ATVC	N+ilJ7r   c                h   V P                   R 8X  d+   V P                  RP                  V P                   4      4        ! R R\        4      pV P	                  \
        4      ;_uu_ 4        V P                  P                  \        V! 4       .^
,          4       RRR4       R#   + '       g   i     R# ; i)r   r   c                   &   a  ] tR tRt o R tRtV tR# )*_TestPool.test_map_unplicklable.<locals>.Ai   c                    \        R 4      h)zcannot picklerg  r   s   &r   r   5_TestPool.test_map_unplicklable.<locals>.A.__reduce__!  s    "?33r   r\   Nr  r   s   @r   Ar(     s     4 4r   r+  N)	r   r   r   r  ro   rh  r  r  r  )rs   r+  s   & r   test_map_unplicklable_TestPool.test_map_unplicklable  sr    99	!MM7>>tyyIJ	4 	4 |,,IIMM#uRx( -,,,s   (.B  B1	c                     V P                   P                  \        . ^R7      P                  \        R7       R#   \
        P                   d    T P                  R4        R# i ; i)r   r  r   z2pool.map_async with chunksize stalled on null listN)r  r  r  r   r~  r   TimeoutErrorrl   r   s   &r   test_map_chunksize_TestPool.test_map_chunksize&  sS    	LIIR1599(9K++ 	LIIJK	Ls   6: &A$#A$c           	     j   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  \        4      ;_uu_ 4        V P
                  P                  \        \        ^R4      ^4       RRR4       V P                  \        4      ;_uu_ 4        V P
                  P                  \        \        ^R4      ^4       RRR4       V P                  \        4      ;_uu_ 4        V P
                  P                  \        \        ^
^4      ^4       RRR4        ! R R4      pV P                  \        4      ;_uu_ 4        V P
                  P                  \        V! 4       ^4       RRR4       V P                  \        4      ;_uu_ 4        V P
                  P                  \        V! 4       ^4       RRR4       R#   + '       g   i     ELW; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)r   r   Nc                   2   a  ] tR tRt o R tR tR tRtV tR# )E_TestPool.test_map_handle_iterable_exception.<locals>.SpecialIterablei:  c                    V # r   r\   r   s   &r   r  N_TestPool.test_map_handle_iterable_exception.<locals>.SpecialIterable.__iter__;  s    r   c                    \         hr   )r  r   s   &r   __next__N_TestPool.test_map_handle_iterable_exception.<locals>.SpecialIterable.__next__=  s    ""r   c                    ^# r   r\   r   s   &r   r  M_TestPool.test_map_handle_iterable_exception.<locals>.SpecialIterable.__len__?  s    r   r\   N)	ry   rz   r{   r|   r  r8  r  r   r   r   s   @r   SpecialIterabler4  :  s     # r   r<  rA   )	r   r   r   ro   r  r  r  r  r  )rs   r<  s   & r   "test_map_handle_iterable_exception,_TestPool.test_map_handle_iterable_exception,  sc   99	!MM7>>tyyIJ |,,IIMM#;ArBAF - |,,IIMM#;ArBAF - |,,IIMM#;BBAF -	 	 |,,IIMM#0!4 -|,,IIMM#0!4 -,% -,, -,, -, -,,,,s<   ,G*,G';,G;'H"'H!G$	'G8	;H	H	!H2	c                    V P                   P                  \        ^\        34      p\	        VP
                  4      pV P                  V! 4       ^14       V P                  VP                  \        4       R# )rh  N)	r  apply_asyncr  r~  r   r   rn   r   r   )rs   r   r   s   &  r   
test_async_TestPool.test_asyncF  sP    ii##C!X8CGG$#$$S[[(;r   c                n   V P                  ^4      p V P                  R8X  d   \        P                  ! 4       MRpVP	                  \
        ^\        \        P                  ,           V34      p\        VP                  4      pV P                  \        P                  V\        R7       V P                  VP                  \        4       Ve   VP!                  4        VP#                  4        VP%                  4        R#   Xe   TP!                  4        TP#                  4        TP%                  4        i ; i)r^  r   Nr   )r  r   rA  r7  r@  r  r  r   r0  r   r   ro   r   r/  r   r   r   r'  r   )rs   r   rV  r   r   s   &    r   test_async_timeout_TestPool.test_async_timeoutL  s    IIaL
	)-i)?IOO%TE--aG4I4I)I5%QRC(Co::CR((h? 		KKMFFH  		KKMFFHs   B5C> >6D4c                
   V P                   P                  \        \        \	        ^
4      4      4      pV P                  \        V4      \        \        \        \        \	        ^
4      4      4      4      4       V P                   P                  \        \        \	        ^
4      4      4      p\	        ^
4       F$  pV P                  \        V4      W",          4       K&  	  V P                  \        VP                  4       V P                   P                  \        \        \	        R4      4      ^dR7      p\	        R4       F$  pV P                  \        V4      W",          4       K&  	  V P                  \        VP                  4       R# r  r+  r  N)r  imapr  r   r  rn   r  r  ro   StopIterationr8  rs   r  r  s   &  r   	test_imap_TestPool.test_imapZ  s    YY^^CeBi1b4CeBi(A#BCYY^^CeBi1rAT"Xqs+ -5YY^^CeDk!2c^BtAT"Xqs+ -5r   c                   V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  P	                  \
        \        ^R4      ^4      pV P                  \        VP                  4       V P                  P	                  \
        \        ^R4      ^4      pV P                  \        VP                  4       V P                  P	                  \
        \        ^
^4      ^4      p\        ^4       F$  pV P                  \        V4      W",          4       K&  	  V P                  \        VP                  4       V P                  P	                  \
        \        ^^4      ^4      p\        ^4       F$  pV P                  \        V4      W",          4       K&  	  V P                  \        VP                  4       V P                  P	                  \
        \        ^^4      ^4      p\        ^4       F$  pV P                  \        V4      W",          4       K&  	  V P                  \        VP                  4       R# r   r   NrA   )r   r   r   r  rH  r  r  ro   r  r8  r  rn   r  rJ  s   &  r   #test_imap_handle_iterable_exception-_TestPool.test_imap_handle_iterable_exceptionh  s   99	!MM7>>tyyIJ YY^^C!=a!DaH,4YY^^C!=a!DaH,4YY^^C!=b!!DaHqAT"Xqs+ ,4 YY^^C!=b!!DaHqAT"Xqs+ ,4YY^^C!=b!!DaHqAT"Xqs+ ,4r   c                   V P                   P                  \        \        \	        ^
4      4      4      pV P                  \        V4      \        \        \        \        \	        ^
4      4      4      4      4       V P                   P                  \        \        \	        R4      4      ^dR7      pV P                  \        V4      \        \        \        \        \	        R4      4      4      4      4       R# rG  )r  imap_unorderedr  r   r  rn   r  r  )rs   r  s   & r   test_imap_unordered_TestPool.test_imap_unordered  s    YY%%c4b	?;T#c4b	?*C%DEYY%%c4d+<%LT#c4d3D*E%FGr   c           
        V P                   R 8X  d+   V P                  RP                  V P                   4      4       V P                  P	                  \
        \        ^R4      ^4      pV P                  \        VP                  4       V P                  P	                  \
        \        ^R4      ^4      pV P                  \        VP                  4       V P                  P	                  \
        \        ^
^4      ^4      p\        \        \
        \        \        ^
4      4      4      4      pV P                  \        4      ;_uu_ 4        \        ^
4       F0  p\        V4      pV P                  WB4       VP                  V4       K2  	  RRR4       V P                  P	                  \
        \        ^^4      ^4      p\        \        \
        \        \        ^4      4      4      4      pV P                  \        4      ;_uu_ 4        \        ^4       F0  p\        V4      pV P                  WB4       VP                  V4       K2  	  RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; irN  )r   r   r   r  rR  r  r  ro   r  r8  r   r  r  r  rp   r  )rs   r  expected_valuesr  r   s   &    r   -test_imap_unordered_handle_iterable_exception7_TestPool.test_imap_unordered_handle_iterable_exception  s   99	!MM7>>tyyIJ YY%%c&B1b&I&') 	,4YY%%c&B1b&I&') 	,4YY%%c&B2q&I&') s3U2Y89|,,2YRe5&&u-  - YY%%c&B2q&I&') s3U2Y89|,,2YRe5&&u-  -, -, -,,s   A I
 A I
I	I.	c                   V P                   R 8X  d   \        M\        pV P                  WP                  R4       V P                  WP                  ^ 4       V P                   R 8w  dZ   V P	                  ^4      p V P                  ^\        VP                  4      4       VP                  4        VP                  4        R# R#   TP                  4        TP                  4        i ; i)r   NrA   )
r   RemoteErrorrE   ro   r  rn   r   _poolr    r   )rs   expected_errorr   s   &  r   test_make_pool_TestPool.test_make_pool  s    )-i)?+) 	 	.))R8.))Q799	!		!A  CL1	 "
 	s   9%C "C$c                Z   \         P                  pV P                  R 8X  d   ^pV P                  ^4      p\	        R4       Uu. uF  q1NK  	  ppVP                  \        P                  V^R7      p\        P                  ! R4       VP                  4        VP                  4        R# u upi )r   i'  r  r  N)
r   r%  r   r  r  r  r   r-  r'  r   )rs   
sleep_timer   r  rQ   r  s   &     r   r}  _TestPool.test_terminate  s    ))
99	! JIIaL$)&M2Mq
M2TZZ;

3			 3s   
B(c                   V P                  ^4      pV P                  VP                  \        . 4      . 4       V P                  \	        VP                  \        . 4      4      . 4       V P                  \	        VP                  \        . 4      4      . 4       V P                  VP                  \        . 4      P                  4       . 4       VP                  4        VP                  4        R# r   )r  rn   r  r  r   rH  rR  r  r   r    r   rs   r   s   & r   test_empty_iterable_TestPool.test_empty_iterable  s    IIaLsB,affS"o.3a..sB78"=S"-113R8			r   c                   V P                   R 8X  d   \        \        ^
4      4      pV Uu. uF  p\        V4      NK  	  ppV P	                  ^4      ;_uu_ 4       pVP                  \        V4      pV P                  VP                  4       V4       RRR4       XP                  4        V P                  \        VP
                  \        V4       R# R# u upi   + '       g   i     LO; ir>  )r   r   r  r  r  r  rn   r   r   ro   rE   )rs   Lr  r  r   rs   &     r   test_context_TestPool.test_context  s    99#U2YA()*1AH*1KKQ'  (3  FFHj!++sA> $*s   C7CC'	c                    \        ^{4      h{   rg  rQ  s   &r   _test_traceback_TestPool._test_traceback  s    3r   c           	     N   V P                   R 8X  Ed    V P                  ^4      ;_uu_ 4       p VP                  V P                  4       V P	                  R4       RRR4       XP                  4        V P                  \        X4      \        4       V P                  VP                  R4       VP                  pV P                  \        V4      \        P                  P                  4       V P!                  RVP"                  4       \$        P&                  P)                  4       ;_uu_ 4       p VhR#   \
         d   pTp Rp?LRp?ii ; i  + '       g   i     L; i  \         d+    \*        P,                  ! \*        P.                  ! 4       !    Mi ; i RRR4       M  + '       g   i     M; iT P!                  RXP1                  4       4       T P                  ^4      ;_uu_ 4       p TP3                  \4        \7        ^R4      ^4       T P	                  R4       M  \
         d   pTp Rp?MRp?ii ; iT P                  \        T4      \8        4       T P                  TP                  R4       RRR4       M  + '       g   i     M; iTP                  4        R# )r   zexpected RuntimeErrorNz&raise RuntimeError(123) # some commentzexpected SayWhenErrorrl  rA   )r   r  r  rn  rl   rk   r   r:  r;  rh  rn   rQ   	__cause__r   r  RemoteTracebackrp   tbr  r   r  r   
excepthookexc_infogetvaluer  r  r  r  )rs   r   r<  exccausef1s   &     r   test_traceback_TestPool.test_traceback  s    99#17GGD001 II56  FFHMM$s)\2SXXv.MMEMM$u+';';'K'KLMMBEHHM--//24I# $ ! C " $ 4NNCLLN343	 0///
 MMB++-) 17EE#;ArBAF II56 ! C d3i6cmmT2  FFHs   ED4	E.F#0E!4E?EEEEE	!2FF#FF##F3	/J1!H$J$H;/H61J6H;;>JJ	c                    \        R 4      h)r  rg  rQ  s   &r   _test_wrapped_exception!_TestPool._test_wrapped_exception  s    5!!r   c           	     8   V P                  ^4      ;_uu_ 4       pV P                  \        4      ;_uu_ 4        VP                  V P                  4       RRR4       RRR4       XP                  4        R#   + '       g   i     L*; i  + '       g   i     L5; ir   )r  ro   rh  r  r}  r   rc  s   & r   test_wrapped_exception _TestPool.test_wrapped_exception  sZ    YYq\\Q""<00445 1  	
 10 \s"   B	A6	B	6BB		B	c           	     z   \         P                  ! 4       pV P                  \        4      ;_uu_ 4        V P	                  ^4      ;_uu_ 4       p VP                  \        ^ ^.4       \         P                  ! R4       VP                  4        VP                  4         RRR4       RRR4       V P                  \         P                  ! 4       V,
          R4       R#   \         P                  ! R4       TP                  4        TP                  4        i ; i  + '       g   i     L; i  + '       g   i     L; i)r   r  Ng?)r   r   ro   rE   r  r  r  r-  r    r   r  )rs   t_startr   s   &  r   test_map_no_failfast_TestPool.test_map_no_failfast  s     .."z**1EE/!Q8JJsOGGIFFH  + 	4>>+g5s; JJsOGGIFFH  +*s;   D*D	C'6D	D*8DD	D'"D**D:	c                   \        ^
4       Uu. uF  p\        4       NK  	  ppV Uu. uF  p\        P                  ! V4      NK  	  ppV P                  P                  \        V4       ?\        P                  ! \        4       \        P                  ! 4        V P                  \        R V 4       4      R04       V P                  \        P                  ^ 4       R# u upi u upi )r  c              3   .   "   T F  q! 4       x  K  	  R # 5ir   r\   )r  r  s   & r   r  3_TestPool.test_release_task_refs.<locals>.<genexpr>6  s     1DbRTTDs   N)r  r  r  r  r  r  r  r   r-  r  r   
gc_collectrn   r   r  )rs   r  objsorefss   &    r   test_release_task_refs _TestPool.test_release_task_refs,  s     */r3A3(,-1A-		h%

51D11D6: 	22A6 4-s
   CC"c           	        V P                   R 8X  d   V P                  R4       V P                  ^4      pV;_uu_ 4         RRR4       V P                  \        4      ;_uu_ 4        V;_uu_ 4         RRR4       RRR4       VP                  4        R#   + '       g   i     L\; i  + '       g   i     L=; i  + '       g   i     LH; i)r   test not applicable to managerN)r   r   r  ro   rE   r   rs   r  s   & r   
test_enter_TestPool.test_enter;  s~    99	!MM:;yy|T 
 z**  + 			 T  +*s/   B%B:0B'	2B:B$	'B72B::C
	c                   V P                   R 8X  d   V P                  R4       V P                  ^4      pVP                  4        VP	                  4        \
        P                  P                  Vn        \        P                  ! R\        34      ;_uu_ 4        Rp\        P                  ! 4        RRR4       R#   + '       g   i     R# ; i)r   r  z%unclosed running multiprocessing poolN)r   r   r  r'  r   r   r  RUN_stater
   check_warningsResourceWarningr   r  r  s   & r   test_resource_warning_TestPool.test_resource_warningK  s    99	!MM:;yy|		 &**..++8/JL LD L L L Ls   B99C
	r\   )%ry   rz   r{   r|   r"  r  r  r  r  r  r  r  r$  r,  r0  r=  rA  rD  rK  rO  rS  rW  r]  r}  rd  ri  rn  rz  r}  r  r  r  r  r  r   r   __classcell__r   r   s   @@r   r  r  
  s          =
;??
:8)L54<654H".H"
?    $L " "<(7 ! !r   r  c                      \        R 4      hkey)KeyErrorr\   r   r   raisingr  [  s    
5/r   c                      R  # )c                      ^*# )*   r\   r\   r   r   rI  %unpickleable_result.<locals>.<lambda>_  s    2r   r\   r\   r   r   unpickleable_resultr  ^  s    r   c                   0   a  ] tR tRt o RtR tR tRtV tR# )_TestPoolWorkerErrorsia  c                ^  a \         P                  ! ^4      pR.oV3R lpVP                  \        VR7      pV P	                  \
        VP                  4       V P                  S^ ,          4       V P                  S^ ,          \
        4       VP                  4        VP                  4        R# )r   Nc                    < V S^ &   R# r   r\   rw  
scratchpads   &r   errback@_TestPoolWorkerErrors.test_async_error_callback.<locals>.errbackh  s    JqMr   r"  )r   r  r@  r  ro   r  r   r   r   r    r   )rs   r   r  r   r  s   &   @r   test_async_error_callback/_TestPoolWorkerErrors.test_async_error_callbackd  s}      #V
	  mmGGm<(CGG,
1&jmX6			r   c                  a ^ RI Hp \        P                  ! ^4      p\	        ^4       F  pR.oV3R lpVP                  \        VR7      pV P                  WP                  4       S^ ,          pV P                  V4       V P                  S^ ,          V4       V P                  VP                  4       V P                  VP                  4       K  	  VP                  4        VP                  4        R# )r   )MaybeEncodingErrorNc                    < V S^ &   R# r   r\   r  s   &r   r  ?_TestPoolWorkerErrors.test_unpickleable_result.<locals>.errback{  s     #
1r   r  )multiprocessing.poolr  r   r  r  r@  r  ro   r   r   r   assertIsNotNonerw  r   r    r   )rs   r  r   	iterationr  r   wrappedr  s   &      @r   test_unpickleable_result._TestPoolWorkerErrors.test_unpickleable_results  s    ;  # rIJ$ -- 3G-LC0'': mGOOG$!!*Q-1CD  -  / # 	
		r   r\   Nrg  )	ry   rz   r{   r|   r   r  r  r   r   r   s   @r   r  r  a  s     #M r   r  c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	_TestPoolWorkerLifetimei  c                   \         P                  ! ^^
R7      pV P                  ^\        VP                  4      4       VP                   Uu. uF  q"P
                  NK  	  pp. p\        ^d4       F)  pVP                  VP                  \        V34      4       K+  	  \        V4       F.  w  rgV P                  VP                  4       \        V4      4       K0  	  VP                  4        ^2pV'       dt   \        ;QJ d&    R VP                   4       F  '       d   K   RM	  RM! R VP                   4       4      '       g&   V^,          p\        P                  ! \         4       K{  VP                   Uu. uF  q"P
                  NK  	  p	pV P#                  RV4       V P#                  RV	4       V P%                  \'        V4      \'        V	4      4       VP)                  4        VP+                  4        R# u upi u upi )r^  maxtasksperchildc              3   @   "   T F  qP                  4       x  K  	  R # 5ir   )r   )r  rQ  s   & r   r  D_TestPoolWorkerLifetime.test_pool_worker_lifetime.<locals>.<genexpr>  s     #B'QJJLL's   FTN)r   r  rn   r   r[  r	  r  r  r@  r  	enumerater   _repopulate_poolallr   r-  r  r8  rE  r  r    r   )
rs   r   rQ  origworkerpidsr  r  r,  r   	countdownfinalworkerpidss
   &         r   test_pool_worker_lifetime1_TestPoolWorkerLifetime.test_pool_worker_lifetime  sd     R8CL))*1A%%1sANN1==qe45  "'*HQSWWYA/ + 	
 	#B!''#B#B!''#B B BNIJJu*+''2'Q55'2~./F>2F?4KL			1 2" 3s   G44G9c                f   \         P                  ! ^^R7      p. p\        ^4       F*  pVP                  VP	                  \
        VR34      4       K,  	  VP                  4        VP                  4        \        V4       F.  w  rEV P                  VP                  4       \        V4      4       K0  	  R# )r^  r  g333333?N)r   r  r  r  r@  r  r    r   r  rn   r   )rs   r   r  r  r,  r   s   &     r   %test_pool_worker_lifetime_early_close=_TestPoolWorkerLifetime.test_pool_worker_lifetime_early_close  s       Q7qANN1==q#h78 			!'*HQSWWYA/ +r   c                    R FA  pV P                  \        4      ;_uu_ 4        \        P                  ! ^VR7       RRR4       KC  	  R#   + '       g   i     KX  ; i)r   r  N)r   rA   r  12)ro   rE   r   r  )rs   r   s   & r   "test_pool_maxtasksperchild_invalid:_TestPoolWorkerLifetime.test_pool_maxtasksperchild_invalid  s?    'E"":..$$Q? /. (...s   A

Ac                    R p\         P                  P                  P                  RV4      w  r#pV P	                  V^ 4       R# )a  if 1:
            from multiprocessing import Pool
            problem = None
            class A:
                def __init__(self):
                    self.pool = Pool(processes=1)
            def test():
                global problem
                problem = A()
                problem.pool.map(float, tuple(range(10)))
            if __name__ == "__main__":
                test()
        -cN)r  r   r   assert_python_okrn   rs   cmdr  outrt   s   &    r   >test_worker_finalization_via_atexit_handler_of_multiprocessingV_TestPoolWorkerLifetime.test_worker_finalization_via_atexit_handler_of_multiprocessing  s;     ||11BB4MQr   r\   Nrg  )ry   rz   r{   r|   r   r  r  r  r  r   r   r   s   @r   r  r    s$     #M:0@
   r   r  )BaseManager	BaseProxyrZ  c                   2   a  ] tR tRt o R tR tR tRtV tR# )FooBari  c                    R # )f()r\   r   s   &r   rL  FooBar.f  s    r   c                    \         hr   )rE   r   s   &r   gFooBar.g  s    r   c                    R # )_h()r\   r   s   &r   _h	FooBar._h  s    r   r\   N)	ry   rz   r{   r|   rL  r  r  r   r   r   s   @r   r  r    s      r   r  c               #   F   "   \        ^
4       F  p W ,          x  K  	  R# 5ir  )r  )r  s    r   bazr    s     2Yc	 s   !c                   0   a  ] tR tRt o RtR tR tRtV tR# )IteratorProxyi  c                    V # r   r\   r   s   &r   r  IteratorProxy.__iter__  s    r   c                $    V P                  R 4      # r8  )_callmethodr   s   &r   r8  IteratorProxy.__next__  s    
++r   r\   Nr  )	ry   rz   r{   r|   	_exposed_r  r8  r   r   r   s   @r   r  r    s     I, ,r   r  c                       ] tR tRtRtR# )	MyManageri  r\   Nr  r\   r   r   r  r    s    r   r  Foo)r  Bar)r  exposedr  )r  	proxytypec                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	_TestMyManageri  c                    \        \        R 7      pVP                  4        V P                  V4       VP	                  4        V P                  VP                  P                  ^ \        P                  ) 34       R# )shutdown_timeoutN)
r  SHUTDOWN_TIMEOUTr   commonshutdownrp   _processr   rZ  r|  rs   r   s   & r   test_mymanager_TestMyManager.test_mymanager  sU    -=>G
 	g&&//!fnn_1EFr   c                   \        \        R 7      pV;_uu_ 4        V P                  V4       RRR4       V P                  VP                  P
                  ^ \        P                  ) 34       R#   + '       g   i     LI; ir  )r  r  r  rp   r  r   rZ  r|  r  s   & r   test_mymanager_context%_TestMyManager.test_mymanager_context  sR    -=>WKK  
 	g&&//!fnn_1EF Ws   A..A>	c                    \        \        R 7      pVP                  4        V;_uu_ 4        V P                  V4       RRR4       V P	                  VP
                  P                  ^ 4       R#   + '       g   i     L8; ir  )r  r  r   r  rn   r  r   r  s   & r   !test_mymanager_context_prestarted0_TestMyManager.test_mymanager_context_prestarted  sP    -=>WKK  ))22A6 Ws   A--A=	c                   VP                  4       pVP                  4       pVP                  4       pR Uu. uF  p\        W%4      '       g   K  VNK  	  ppR Uu. uF  p\        W54      '       g   K  VNK  	  ppV P	                  VR R.4       V P	                  VR R.4       V P	                  VP                  4       R4       V P                  \        VP                  4       V P	                  VP                  R 4      R4       V P                  \        VP                  R4       V P	                  VP                  4       R4       V P	                  VP                  4       R4       V P	                  VP                  R 4      R4       V P	                  VP                  R4      R4       T P	                  \        V4      \        ^
4       Uu. uF  qV,          NK  	  up4       R# u upi u upi u upi )rL  r  r  r  r  N)rL  r  r  )r  r  r  rk  rn   rL  ro   rE   r  r  rZ  r  r   r  )	rs   r   r  barr  r,   foo_methodsbar_methodsr  s	   &&       r   r  _TestMyManager.common  sy   kkmkkmkkm(8O(8GC<Ntt(8O(8O(8GC<Ntt(8OsCj1sDk2%(*cee,-u5+s=%(6*-u5.7c%)$<)QqSS)$<=! PO %=s   G!G!G&1G&G+
r\   Nr  )ry   rz   r{   r|   r   r  r  r	  r  r   r   r   s   @r   r  r    s%      M	GG7> >r   r  c                      \         # r   )_queuer\   r   r   	get_queuer  *  s    Mr   c                       ] tR tRtRtRtR# )QueueManageri-  z$manager class used by server processr\   Nry   rz   r{   r|   r}   r   r\   r   r   r  r  -  s    .r   r  r  c                       ] tR tRtRtRtR# )QueueManager2i1  z@manager class which specifies the same interface as QueueManagerr\   Nr  r\   r   r   r  r  1  s    Jr   r  	xmlrpclibc                   T   a  ] tR tRt o Rt. ROt]R,          t]R 4       tR t	Rt
V tR# )	_TestRemoteManageri8  Nri  c                    \        W\        \        R 7      pVP                  4        VP	                  4       pVP                  \        V P                  4      4       R# )addressr   
serializerr  N)r  
SERIALIZERr  connectr  r   r   r;  r   r  r   r   r#   s   &&&  r   _putter_TestRemoteManager._putterB  sC    -/ 	!!#		%

#$r   c                   \         P                  ! ^ 4      p\        \        P                  ^ 3V\
        \        R7      pVP                  4        V P                  VP                  4       V P                  V P                  VP                  V3R7      pRVn        VP                  4        \        VP                  V\
        \        R7      pVP                  4        VP!                  4       pV P#                  VP%                  4       V P&                  4       V P)                  \*        VP,                  \.        P0                  4       ?R# )    r  r   TN)rB   urandomr  r   HOSTr  r  r   r  r   r   r"  r  r   r  r   r  rn   r   r  ro   rk   r   r   r-  )rs   r   r   r   manager2r#   s   &     r   test_remote_TestRemoteManager.test_remoteL  s    **R."''+W-/ 	(()LLGOOW3MLN		 OOW-/ 	""$dkk2 	)UYY

; r   r\   r  )hello worldNT      @u   hallå världenu   привіт світs   hall vrlden)ry   rz   r{   r|   r   r;  r  r"  r"  r)  r   r   r   s   @r   r  r  8  s8      MF
 AYF% % r   r  sha256c                   6   a  ] tR tRt o ]R 4       tR tRtV tR# )_TestManagerRestartii  c                    \        W\        \        R 7      pVP                  4        VP	                  4       pVP                  R4       R# )r  r+  N)r  r  r  r   r  r   r!  s   &&&  r   r"  _TestManagerRestart._putterl  s:    -/ 	!!#		- r   c                J   \         P                  ! ^ 4      p\        \        P                  ^ 3V\
        \        R7      p VP                  4       pVP                  pVP                  P                  4        VP                  4        V P                  V P                  VP                  V3R7      pVP                  4        VP                  4        VP                  4       pV P!                  VP#                  4       R4       ?\%        VR4      '       d   VP'                  4        \        YA\
        \        R7      p TP                  4        T P)                  TP&                  4       R#   \%        TR4      '       d   TP'                  4        i i ; i  \*         d   pTP,                  \,        P.                  8w  d   h \0        P2                  ! R4       \        YA\
        \        R7      p\%        TR4      '       d"   T P)                  TP&                  4        Rp?R#  Rp?R# Rp?ii ; i)r%  r  r   r+  r   r  N)rB   r&  r  r   r'  r  r  
get_serverr  listenerr    r   r   r"  r   r  rn   r   rk  r   r  r  errno
EADDRINUSEr   r-  )rs   r   r   srvrr  r   r#   r<  s   &       r   test_rapid_restart&_TestManagerRestart.test_rapid_restartu  s   **R."''+W!4DF	#%%'D<<D MM!MMODLL7QRAGGIFFH%%'EUYY[-8w
++  "j-/	2MMOOOG,,- w
++  " ,  
	2ww%*** JJsO"*!13G w
++ 0 011 ,
	2s%   C E% 8+F %%F
H"A9HH"r\   N)	ry   rz   r{   r|   r"  r"  r8  r   r   r   s   @r   r/  r/  i  s#      ! !'2 '2r   r/  c                   ,   a  ] tR tRt o R tR tRtV tR# )FakeConnectioni  c                    R # r   r\   )rs   payloads   &&r   r  FakeConnection.send  s    r   c                0    R \         P                  ! 4       3# )z#ERROR)r|  r  r   s   &r   r  FakeConnection.recv  s    ((r   r\   N)ry   rz   r{   r|   r  r  r   r   r   s   @r   r;  r;    s     ) )r   r;  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )TestManagerExceptionsi  c                :    \         P                  ! 4       V n        R # r   )r   r  mgrr   s   &r   r  TestManagerExceptions.setUp  s    "**,r   c                n    V P                   P                  4        V P                   P                  4        R # r   rD  r   r   r   s   &r   r  TestManagerExceptions.tearDown      r   c                   V P                   P                  4       p\        P                  ! 4       '       d5   \        P                  ! 4        V P                  \        P                  4        VP                  4        V P                  X! 4       R 4       R #   \        P                   d!   p\        P                  ! T4      p R p?LIR p?ii ; ir   )rD  r   r  	isenableddisabler  enabler  r|  r  r  r  rn   )rs   r#   r<  r  s   &   r   test_queue_get$TestManagerExceptions.test_queue_get  s~     <<>>JJLOOBII&	  	t$ }} 	 QB	 s   +B C	)CC	c                   \         P                  ! 4       '       d5   \         P                  ! 4        V P                  \         P                  4        \
        P                  P                  \        4       R R 4       V P                  X! 4       R 4       R #   \        P                   d!   p\        P                  ! T4      p R p?LIR p?ii ; ir   )r  rK  rL  r  rM  r   managersdispatchr;  r|  r  r  r  rn   )rs   r<  r  s   &  r   test_dispatch#TestManagerExceptions.test_dispatch  s}    <<>>JJLOOBII&	 $$--n.>dK 	t$ }} 	 QB	 s   )B C(CC)rD  N)
ry   rz   r{   r|   r  r  rN  rS  r   r   r   s   @r   rB  rB    s     -	%% %r   rB   c            	         a  ] tR tRt o Rt]R 4       tR tR tR t	R t
]R 4       t]RR l4       t]P                  ! ]R	4      R
 4       t]P                  ! ]R	4      ]P"                  ! ]P&                  R8H  R4      ]P"                  ! ]R8*  R4      ]P                  ! ]! ]R4      R4      R 4       4       4       4       t]R 4       t]P                  ! ]R	4      ]P"                  ! ]P&                  R8H  R4      R 4       4       tR tRtV tR# )_TestConnectioni  c                    \        VP                  \        4       F  pVP                  V4       K  	  VP	                  4        R # r   )r-  
recv_bytesSENTINEL
send_bytesr    )r   r'  msgs   && r   _echo_TestConnection._echo  s,    2COOC  3

r   c                   V P                  4       w  rV P                  V P                  V3R 7      pRVn        VP	                  4        . R
Op\        R4      pV^
,          p\        P                  ! R\        \        ^4      4      4      pV P                  R8X  d.   V P                  \        VP                  4       4      \        4       V P                  VP                  V4      R4       V P                  VP                  4       V4       V P                  VP!                  V4      R4       V P                  VP#                  4       V4       V P                  R8X  Ed   \        P                  ! R^ .^
,          4      p\        V4      ^ .^
\%        V4      ,
          ,          ,           p	V P                  VP!                  V4      R4       V P                  VP'                  V4      \%        V4      VP(                  ,          4       V P                  \        V4      V	4       \        P                  ! R^ .^
,          4      p^ .^,          \        V4      ,           ^ .^\%        V4      ,
          ,          ,           p	V P                  VP!                  V4      R4       V P                  VP'                  V^VP(                  ,          4      \%        V4      VP(                  ,          4       V P                  \        V4      V	4       \+        \        R4      4      pV P                  VP!                  V4      R4        VP'                  V4      p
V P-                  RV
,          4       \5        VP6                  4      pV P                  V! 4       R4       V P9                  VP:                  ^ 4       V P                  V! R4      R4       V P9                  VP:                  ^ 4       V P                  V! \<        4      R4       V P9                  VP:                  \<        4       VP                  R4       \>        P@                  ! R4       V P                  V! \<        4      R4       V P9                  VP:                  ^ 4       V P                  VP                  4       R4       \        R	4      R,          pVP!                  V4       V P                  VP#                  4       V4       VP!                  \B        4       VPE                  4        V P                  R8X  dy   V P                  VPF                  R4       V P                  VPH                  R4       V PK                  \L        VP                  4       V PK                  \L        VP"                  4       VPO                  4        R#   \.        P0                   d)   pT P                  TP2                  T34        Rp?ELrRp?ii ; i)r   TNr+  r  r   zexpected BufferTooShort, got %sFr   X)r   r,  Nz(                                        rA   i   )(r  r   r]  r   r   r   rn  r   r  r   rn   r;  filenor  r  r  r[  rY  r   recv_bytes_intoitemsize	bytearrayrl   r   BufferTooShortrQ   r   r$  r   r   r~  r   r-  rZ  r    readablewritablero   EOFErrorr   )rs   r'  r)  r   rd  r\  longmsgro  bufferr  r   r<  r$  really_big_msgs   &             r   test_connection_TestConnection.test_connection  s0   99;LL

*L?		M"(kk#tE!H~.99#T$++-0#63.c*-t4*C099#[[qc"f-FCyA3"s3x-#88HT__S148T11&9 X79T&\84[[qc"f-FsQwc*aSFSX4E-FFHT__S148T11&!foo:MN X79T&\84uX/FT__W5t<C**62 		;cABTYY''$$T\\15b5)$$T\\15h/$$T\\8<		$

2h.$$T\\15d+s'78'*N;!99#T]]D1T]]D1h		2h8	K #11 5  '445s   2V W*WWc                x   V P                  R R7      w  rV P                  VP                  ^4      R4       V P                  VP                  4       ^4       V P                  R8X  d   V P                  VP
                  R4       V P                  VP                  R 4       V P                  VP
                  R 4       V P                  VP                  R4       V P                  \        VP                  ^4       V P                  \        VP                  4       V P                  \        VP                  4       R# R# )Fr  Nr   T)
r  rn   r  r  r   rf  rg  ro   r  r$  )rs   readerwriters   &  r   test_duplex_false!_TestConnection.test_duplex_false#  s    %0Q.*99#V__d3V__e4V__e4V__d3gv{{A6gv{{3gv{{3 $r   c                   V P                  4       w  rV P                  V P                  V3R 7      pRVn        VP	                  4        VP                  4        \        R4      pVP                  V4       V P                  VP                  4       V4       VP                  \        4       VP                  4        VP                  4        R# r   Tr3  N)r  r   r]  r   r   r    r   r[  rn   rY  rZ  r   )rs   r'  r)  r   r\  s   &    r   test_spawn_close _TestConnection.test_spawn_close0  s      99;LL

*L?		Gn*C0!

	r   c                >   V P                   R 8w  d+   V P                  RP                  V P                   4      4       \        R4      pV P	                  4       w  r#VP                  V4       V P                  VP                  4       V4       VP                  V^4       V P                  VP                  4       VR,          4       VP                  V^^4       V P                  VP                  4       V^^ 4       VP                  V^4       V P                  VP                  4       \        R4      4       VP                  V^^ 4       V P                  VP                  4       \        R4      4       V P                  \        VP
                  V^4       V P                  \        VP
                  V^^4       V P                  \        VP
                  V^^4       V P                  \        VP
                  VR4       V P                  \        VP
                  V^R4       R# )r   r   abcdefghijklmnopqrstuvwxyz:r   NNrU  NrA   )
r   r   r   r   r  r[  rn   rY  ro   rE   )rs   r\  r   r   s   &   r   test_sendbytes_TestConnection.test_sendbytesE  s   99#MM7>>tyyIJ01yy{	S-	S!R1	S!QQs4	S"r3	S"a r3*allC<*allCQ?*allCQ?*allC<*allCB?r   c                     \         P                  ! V4       R #   \         d,   pTP                  \        P                  8X  d    Rp?R# h Rp?ii ; i)TNF)rB   fstatr  r5  EBADF)r   rV  r<  s   && r   _is_fd_assigned_TestConnection._is_fd_assignede  s?    	HHRL   	ww%++%	s    AA
AAc                   V'       dR   \        ^ R4       FA  pV P                  V4      '       d   K  \        P                  ! VP	                  4       V4       KC  	  \
        P                  ! V4      p\        '       d&   \        P                  ! V\        P                  4      p\        P                  ! WR4       \        P                  ! V4       R# )r   r8   N)r  r~  rB   dup2ra  r   recv_handlemsvcrtopen_osfhandlerS  r  r    )r   r'  datacreate_dummy_fdsr  rV  s   &&&&  r   _writefd_TestConnection._writefdp  s~    1c]**1--GGDKKM1- # ""4(6&&r2;;7B

r   $test needs multiprocessing.reductionc                :   V P                   R 8w  d   V P                  R4       V P                  RR7      w  rV P                  V P                  VR3R7      pRVn        VP                  4        V P                  \        P                  \        P                  4       \        \        P                  R4      ;_uu_ 4       pVP                  4       p\        '       d   \        P                  ! V4      p\        P                   ! WVP"                  4       RRR4       VP%                  4        \        \        P                  R4      ;_uu_ 4       pV P'                  VP)                  4       R4       RRR4       R#   + '       g   i     Lm; i  + '       g   i     R# ; i)	r   only makes sense with processesTr  s   foor   wbNrb)r   r   r  r   r  r   r   r  r   rG  rF  rI  ra  r  get_osfhandler   send_handler	  r   rn   rJ  )rs   r'  r)  r   rL  rV  s   &     r   test_fd_transfer _TestConnection.test_fd_transfer|  s   99#MM;<99D91LLZ4HLI			(()*:*:;)""D))QBv))"-!!$AEE2	 *
 	
)""D))QQVVXv. *) *) *))s   =AE6!F	6F		F	r1   *test semantics don't make sense on Windowsr8   z)largest assignable fd number is too smallr  ztest needs os.dup2()c                   V P                   R 8w  d   V P                  R4       V P                  RR7      w  rV P                  V P                  VRR3R7      pRVn        VP                  4        V P                  \        P                  \        P                  4       \        \        P                  R4      ;_uu_ 4       pVP                  4       p\        R\        4       F  pV P                  V4      '       d   K   M	  V P!                  R4       \"        P$                  ! VX4        \&        P(                  ! WVP*                  4       \"        P,                  ! V4        R	R	R	4       VP/                  4        \        \        P                  R
4      ;_uu_ 4       pV P1                  VP3                  4       R4       R	R	R	4       R	#   \"        P,                  ! T4       i ; i  + '       g   i     L; i  + '       g   i     R	# ; i)r   r  Tr  s   barr   r  r8   z2could not find an unassigned large file descriptorNr  )r   r   r  r   r  r   r   r  r   rG  rF  rI  ra  r  MAXFDr~  rl   rB   r  r   r  r	  r    r   rn   rJ  )rs   r'  r)  r   rL  rV  newfds   &      r   test_large_fd_transfer&_TestConnection.test_large_fd_transfer  sd    99#MM;<99D91LLZ4NLO			(()*:*:;)""D))QBsE*++E22 + 		NOGGB %%d1559 * 	
)""D))QQVVXv. *)  *) *))s6   >8G ;,G (!G	G !G3GG  G0	3H	c                P    \         P                  ! VP                  4       R 4       R# )    N)rB   r  ra  rs   r'  s   &&r   _send_data_without_fd%_TestConnection._send_data_without_fd  s    
&r   zdoesn't make sense on Windowsc                F   V P                   R 8w  d   V P                  R4       V P                  RR7      w  rV P                  V P                  V3R7      pRVn        VP                  4        V P                  \        \        P                  V4       VP                  4        R# )r   r  Tr  r   N)r   r   r  r   r  r   r   ro   rh  r   r  r   rs   r'  r)  r   s   &   r   test_missing_fd_transfer(_TestConnection.test_missing_fd_transfer  s{    
 99#MM;<99D91LL : :*LO		,	(=(=tD	r   c           	        V P                  4       w  rT;_uu_ 4        T;_uu_ 4        VP                  R 4       V P                  VP                  4       R 4       V P                  R8X  d7   V P                  VP                  4       V P                  VP                  4       RRR4       RRR4       V P                  R8X  dy   V P                  VP                  4       V P                  VP                  4       V P                  \        VP                  4       V P                  \        VP                  4       R# R#   + '       g   i     L; i  + '       g   i     L; i)  r   N)
r  r  rn   r  r   r   closedr   ro   r  r   s   &  r   ri  _TestConnection.test_context  s    yy{QFF4LQVVXt,yyK'  *  * Q 99#OOAHH%OOAHH%gqvv.gqvv.	 $ QQs#   EA9D<	!E<EEE	r\   Nr  r`  )ry   rz   r{   r|   r   r"  r]  rl  rq  ru  ry  r~  r  rF   r#  HAS_REDUCTIONr  r~   r   r   r  rk  rB   r  r  r  ri  r   r   r   s   @r   rW  rW    s]    ,M 
M^4*@@   	 	 (NO/ P/$ (NO__S\\W,AC__Uc\@BV,/1/1BC P/4 ' ' (NO__S\\W,.MN O P/ /r   rW  c                   |   a  ] tR tRt o R	tR tR tR t]P                  ! ]
P                  R4      R 4       tRtV tR# )
_TestListeneri  c                   V P                   P                   Fp  pV P                   P                  VR 7      pV P                  VP                  4       V P                  \        V P                   P                  VP                  V4       Kr  	  R# familyN)r  familiesListenerr  r    ro   r  r  )rs   r  r  s   &  r   test_multiple_bind _TestListener.test_multiple_bind  sb    oo..F(((7AOOAGG$gt'?'?ii1 /r   c                D   V P                   P                  4       ;_uu_ 4       pV P                   P                  VP                  4      ;_uu_ 4       pVP	                  4       ;_uu_ 4       pVP                  R 4       V P                  VP                  4       R 4       RRR4       RRR4       RRR4       V P                  R8X  d#   V P                  \        XP                  4       R# R#   + '       g   i     LU; i  + '       g   i     L`; i  + '       g   i     Lk; i)r  Nr   r  r  r  r  acceptr  rn   r  r   ro   r  )rs   r  r   r\  s   &   r   ri  _TestListener.test_context  s    __%%''1''		22aXXZZ1FF4L$$QVVXt4   3 ( 99#gqxx0 $	  Z 32 ('s;   .DC<	*2C)C<	$D)C94C<	<DDD	c           	       a  R  pV 3R lpRpS P                   P                  VR7      ;_uu_ 4       p\        P                  ! W$P                  V3R7      pVP                  4         VP                  4       ;_uu_ 4       pS P                  VP                  4       R4       RRR4       VP                  4         RRR4       S P                  R8X  d9   S P                  \        4      ;_uu_ 4        XP                  4        RRR4       R# R#   + '       g   i     Lt; i  TP                  4        i ; i  + '       g   i     L; i  + '       g   i     R# ; i)c                      \        R 4      h)zConnection took too long...rg  r\  s   *r   ri  1_TestListener.test_empty_authkey.<locals>.handler  s    <==r   c                 b   < SP                   P                  WR 7      pVP                  R4       R# )r  r  N)r  r  r  )r  r   r  rs   s   && r   r0  -_TestListener.test_empty_authkey.<locals>.run  s&    __++D+BFKKr   r   r  r   r  Nr   )r  r  rA  r  r  r   r  rn   r  r   r   ro   r  )rs   ri  r0  r  r4  threadr\  s   f      r   test_empty_authkey _TestListener.test_empty_authkey  s    	>	 __%%c%22h%%S8H8H#7NOFLLN__&&!$$QVVXt4 '  3 99#""7++! ,+ $ '&  32 ,++sG   4D3&D>!D	D'D3.EDDD00D33E	E	z"test needs abstract socket supportc                F   V P                   P                  R 4      ;_uu_ 4       pV P                   P                  VP                  4      ;_uu_ 4       pVP	                  4       ;_uu_ 4       pVP                  R4       V P                  VP                  4       R4       RRR4       RRR4       RRR4       V P                  R8X  d#   V P                  \        XP                  4       R# R#   + '       g   i     LU; i  + '       g   i     L`; i  + '       g   i     Lk; i)z
 somethingr  Nr   r  )rs   r4  r  r\  s   &   r   test_abstract_socket"_TestListener.test_abstract_socket   s     __%%m44''(8(899V__&&!KK%$$QVVXt4 ' : 5 99#gx7 $	 '& :9 54s;   .DC=	+2C*C=	%D*C:5C=	=DDD 	r\   Nrg  )ry   rz   r{   r|   r   r  ri  r  rF   r#  r   abstract_sockets_supportedr  r   r   r   s   @r   r  r    sC     "M11"0 88=?8?8r   r  c                   F   a  ] tR tRt o Rt]R 4       tR tR tR t	Rt
V tR# )	_TestListenerClienti  c                ~    V P                   P                  V4      pVP                  R 4       VP                  4        R# )r3  N)r  r  r  r    )r   r  r'  s   && r   r  _TestListenerClient._test  s+    ~~$$W-		'

r   c                   V P                   P                   F  pV P                   P                  VR 7      pV P                  V P                  VP
                  3R7      pRVn        VP                  4        VP                  4       pV P                  VP                  4       R4       VP                  4        VP                  4        K  	  R# )r  r   Tr3  N)r  r  r  r   r  r  r   r   r  rn   r  r   r    )rs   r  r  r   r'  s   &    r   test_listener_client(_TestListenerClient.test_listener_client  s    oo..F(((7ADJJaii\BAAHGGI88:DTYY['2FFHGGI /r   c                   V P                   P                  4       pV P                  V P                  VP                  3R 7      pRVn        VP                  4        \        P                  ! ^4       VP                  4       pV P                  VP                  4       R4       VP                  4        VP                  4        VP                  4        R# rt  )r  r  r   r  r  r   r   r   r-  r  rn   r  r    r   )rs   r  r   r'  s   &   r   test_issue14725#_TestListenerClient.test_issue14725"  s    OO$$&LL

!))L>		

1
 xxzg.

			r   c                   V P                   P                   F  pV P                   P                  VR 7      pV P                   P                  VP                  4      pVP                  4       pVP                  R4       V P                  VP                  ^4      4       VP                  4        VP                  4        VP                  4        K  	  R# )r     helloN)
r  r  r  r  r  r  r[  r   r$  r    )rs   famr  r   r   s   &    r   test_issue16955#_TestListenerClient.test_issue169552  s    ??++C(((4A&&qyy1A
ALL"OOAFF1I&GGIGGIGGI ,r   r\   Nr  )ry   rz   r{   r|   r   r"  r  r  r  r  r   r   r   s   @r   r  r    s0     ,M 
	 	 	r   r  c                   l   a  ] tR tRt o RtR t]R 4       tR t]R 4       t	R t
]R 4       tR tR	tV tR
# )	_TestPolli=  c                   V P                  4       w  rV P                  VP                  4       R 4       VP                  R4       V P                  VP                  4       R4       V P                  VP                  4       R4       R# )Fr   TN)r  rn   r$  r[  r   s   &  r   test_empty_string_TestPoll.test_empty_stringA  s]    yy{5)	S4(4(r   c                    V F*  p\         P                  ! R 4       VP                  V4       K,  	  VP                  4        R# r   N)r   r-  r[  r    )r   r'  stringsr   s   &&& r   _child_strings_TestPoll._child_stringsH  s.    AJJsOOOA  	

r   c                T   RpV P                  4       w  r#V P                  V P                  W13R7      pVP                  4        V FO  p\	        ^4       F  pVP                  R4      '       g   K   M	  VP                  4       pV P                  WW4       KQ  	  VP                  4        R# )r  r   r  N)r  r      a   br   s   byer   s   lop)	r  r   r  r   r  r$  rY  rn   r   )rs   r  r   r   r   r   r  r1  s   &       r   test_strings_TestPoll.test_stringsO  s    Gyy{LL 3 31,LG		A3Z66$<<   AQ"  	
r   c                (    VP                  ^4       R# r   )r$  )r   rh  s   &&r   _child_boundaries_TestPoll._child_boundaries^  s     	
q	r   c                p   V P                  R 4      w  rV P                  V P                  V3R7      pVP                  4        \        P
                  ! ^4       RR.pV F  pVP                  V4       K  	  VP                  4        VP                  4        V P                  VP                  4       V4       R# )Fr   s   firsts   secondN)r  r   r  r   r   r-  r[  r    r   rp   rY  )rs   rh  rQ  r   rg  r  s   &     r   test_boundaries_TestPoll.test_boundariesf  s    yyLL 6 6aTLB		

1y!CLL 			allna(r   c                l    VP                  R 4       VP                  R4       VP                  R4       R# )r  r     cdN)r[  )r   r   s   &&r   _child_dont_merge_TestPoll._child_dont_merger  s&    	T	T	Ur   c                4   V P                  4       w  rV P                  VP                  R 4      R4       V P                  VP                  R4      R4       V P                  V P                  V3R7      pVP                  4        V P                  VP                  4       R4       V P                  VP                  R4      R4       V P                  VP                  R4      R4       V P                  VP                  4       R4       V P                  VP                  R4      R4       V P                  VP                  R4      R4       V P                  VP                  R 4      R4       V P                  VP                  4       R4       VP                  4        R	# )
r3   Fr   r   r  r  Tr  r  N)r  rn   r$  r   r  r   rY  r   )rs   r   r   r   s   &   r   test_dont_merge_TestPoll.test_dont_mergex  s%   yy{e,e,LL 6 6aTLB		.d+d+.d+d+d+/	r   r\   Nr  )ry   rz   r{   r|   r   r  r"  r  r  r  r  r  r  r   r   r   s   @r   r  r  =  s_     ,M)    
)  
 r   r  r  c                   p   a  ] tR tRt o R
t]R 4       t]R 4       t]R 4       tR t	]R 4       t
R tRtV tR	# )_TestPicklingConnectionsi  c                R    ^ RI Hp VP                  \        P                  R7       R# )r   )resource_sharerr   N)r   r  r6  r   r%  )r   r  s   & r   r  &_TestPicklingConnections.tearDownClass  s    3W%9%9:r   c                8   V F{  pV P                   P                  VR 7      pVP                  VP                  4       VP	                  4       pVP                  V4       VP                  4        VP                  4        K}  	  \        P                  ! \        P                  ^ 34      pVP                  VP                  4       4       VP	                  4       w  rVVP                  V4       VP                  4        VP                  4        VP                  4        R# r  )r  r  r  r  r  r    socketcreate_serverr   r'  getsocknamer  )r   r'  r  r  r  new_connr  s   &&&    r   	_listener"_TestPicklingConnections._listener  s    C''s'3AIIaii xxzHIIhNNGGI    -"4"4a!89		!--/"		(				r   c                   \        VP                  R 4       FO  w  r#V P                  P                  V4      pVP	                  VP                  4       4       VP                  4        KQ  	  VP                  4       w  r#\        P                  ! 4       pVP                  V4       VP                  VP                  4       4       VP                  4        VP                  4        R # r   )
r-  r  r  r  r  r.  r    r  r   sendall)r   r'  r  r\  r  s   &&   r   _remote _TestPicklingConnections._remote  s    "499d3NW^^**73FKK		$LLN 4
 yy{wsyy{#

r   c                   V P                   P                  pV P                  4       w  r#V P                  V P                  W13R 7      pRVn        VP                  4        VP                  4        V P                  4       w  rVV P                  V P                  V3R 7      pRVn        VP                  4        VP                  4        V F{  pRV,          P                  R4      p	VP                  4       p
VP                  W34       VP                  4       pV P                  VP                  4       V	P                  4       4       K}  	  VP                  R4       \        R4      p	VP                  4       p
VP                  W34       VP                  4       p. p VP                  ^d4      pV'       g   MVP                  V4       K.  RP!                  V4      pV P                  WP                  4       4       VP                  4        VP                  R4       VP                  4        VP                  4        VP!                  4        VP!                  4        R# )r   TzThis connection uses family %sasciiNz$This connection uses a normal socketr   )r  r  r  r   r  r   r   r    r  r   r  r  rn   r.  r   r  r   )rs   r  lconnlconn0lpr  rconn0rpr  r\  r  r  bufr   s   &             r   test_pickling&_TestPicklingConnections.test_pickling  s   ??++		\\v6H\I	

		\\VI\>	

C3c9AA'JCjjlGJJ~&zz|HX]]_ciik:  	

4:;**,

G>"::<c"AJJqMhhsmiik*

4
	
	r   c                    VP                  4       pVP                  R 4       VP                  4        VP                  4       pVP                  4       pVP                  V^,          4       VP                  4        R# )all is wellN)r  r  r    )r   r'  rQ  rh  r\  s   &&   r   child_access%_TestPicklingConnections.child_access  sQ    IIK	}		IIKffh		#a%

r   c                   V P                  4       w  rV P                  V P                  V3R 7      pRVn        VP	                  4        VP                  4        V P                  RR7      w  rEVP                  V4       VP                  4        V P                  VP                  4       R4       VP                  4        V P                  RR7      w  rEVP                  V4       VP                  4        VP                  R4       VP                  4        V P                  VP                  4       R4       VP                  4        R# )r   TFr  r  foobarNfoobarfoobar)
r  r   r  r   r   r    r  rn   r  r   )rs   r'  r)  r   rh  rQ  s   &     r   test_access$_TestPicklingConnections.test_access  s      99;LL 1 1LF		yyy&		!		=1		yyy&		!			x		j1	r   r\   Nrg  )ry   rz   r{   r|   r   r"  r  r  r  r  r  r  r   r   r   s   @r   r  r    sj      #M; ;  $  ,\ 	 	 r   r  c                   N   a a ] tR tRt oRtV 3R ltV 3R ltR tR tRt	Vt
V ;t# )	_TestHeapi  c                   < \         SV `  4        \        P                  P                  P
                  V n        \        P                  P                  4       \        P                  P                  n        R # r   )r  r  r   r  r  _heapold_heapHeaprs   r   s   &r   r  _TestHeap.setUp  sH    ',,::@@3B3G3G3L3L3N**0r   c                v   < V P                   \        P                  P                  n        \
        SV `  4        R # r   )r  r   r  r  r  r  r  r  s   &r   r  _TestHeap.tearDown!  s&    37==**0r   c                   R p^2p. p\         P                  P                  P                  p^ Vn        \        V4       F  p\        \        P                  ! ^ ^4      R,          4      p\         P                  P                  V4      pVP                  V4       \        V4      V8  d   \        P                  ! V4      pW5 ?K  	  VP                  ;_uu_ 4        . p^ p	^ p
\        VP                  P                  4       4       FR  pV FI  w  rpVP                  VP                   P#                  V4      WW,
          R34       WV,
          ,          p	KK  	  KT  	  VP$                  P'                  4        FS  w  rV FH  w  rVP                  VP                   P#                  V4      WW,
          R34       WV,
          ,          p
KJ  	  KU  	  V P)                  W,           \+        R VP                    4       4      4       VP-                  4        \        \        V4      ^,
          4       F  pW,          R,          w  rpW^,           ,          R,          w  pppVV8w  dA   V P)                  WP                   V,          P.                  4       V P)                  V^ 4       Kv  V P)                  VV4       K  	  RRR4       \        P0                  ! V4       V'       d   VP3                  4        K  V P)                  VP4                  VP6                  4       V P)                  \        VP8                  4      ^ 4       V P)                  \        VP                   4      ^ 4       V P)                  \        VP$                  4      ^ VP$                  4       V P)                  \        VP                  4      ^ 4       R#   + '       g   i     EL; i)  r+  freeoccupiedc              3   8   "   T F  qP                   x  K  	  R # 5ir   rs  )r  arenas   & r   r  &_TestHeap.test_heap.<locals>.<genexpr>K  s      Fs   :Nr^  NN)r   r  r  r  _DISCARD_FREE_SPACE_LARGER_THANr  r  randomlognormvariater  r   	randranger  r   _len_to_seqr;  _arenasr  _allocated_blocksr  rn   sumsortrs  shuffler  _n_frees
_n_mallocs_pending_free_blocks)rs   
iterations	maxblocksblocksr  r  rs  r   r  r  r  rg  r  r   r6  arena_blocksnarenanstartnstops   &                  r   	test_heap_TestHeap.test_heap%  s   
	 ##1177/0, z"Av,,Q2T9:D$$2248AMM!6{Y&$$Y/I # ZZZCDH$**1134*+&E$JJ 2 25 95 $
F 4 5%Z(D +, 5 (,'='='C'C'E##/KEJJ 2 25 95 $
J 8 9e,H $0 (F T_  F FFH HHJ3s8A:&'*vbz$t*-c(2,'F?$$T<<+>+C+CD$$VQ/ $$T62 '- D 	vJJL8T667;T\\*A.T334a9O9OPT--.2U ZZs   GN11O	c                   \         P                  ! 4       '       g5   \         P                  ! 4        V P                  \         P                  4       \         P
                  ! 4       pV P                  ! \         P                  .VO5!   \         P                  ! ^
4       \        R4       FM  p\        P                  P                  ^4      p\        P                  P                  ^4      pWCn        W4n        KO  	  R# )r  r  N)r  rK  rM  r  rL  get_thresholdset_thresholdr  r   r  r  buddy)rs   
thresholdsr  r   r   s   &    r   test_free_from_gc_TestHeap.test_free_from_gce  s     ||~~IIKOOBJJ'%%'
((6:6
 tA$$2215A$$2215AGG r   )r  rg  )ry   rz   r{   r|   r   r  r  r4  r;  r   r   r  r  s   @@r   r  r    s%     "MO>3@ r   r  c                   ,    ] tR tRtR]3R]3R]3.tRtR# )_Fooi  r1  r2  zr\   N)	ry   rz   r{   r|   r<   r=   r>   _fields_r   r\   r   r   r>  r>    s    	e	h	j
Hr   r>  c                   P   a  ] tR tRt o R	tR t]R 4       tR
R ltR t	R t
RtV tR# )_TestSharedCTypesi  c                D    \         '       g   V P                  R 4       R# R# r4  r5  r   s   &r   r  _TestSharedCTypes.setUp  r7  r   c                   V;P                   ^,          un         V;P                   ^,          un         V;P                   ^,          un         V;P                  ^,          un        V;P                  ^,          un        V;P                   ^,          un         \        \	        V4      4       F  pWW;;,          ^,          uu&   K  	  R# r  )r   r1  r2  r  r   )r   r1  r2  r?  r  ro  stringr  s   &&&&&&& r   _double_TestSharedCTypes._double  sn    	1	1	1

s3xAFaKF !r   c           	     v   \        R ^VR7      p\        \        R
VR7      p\        \        RVR7      p\        \        ^^VR7      pV P	                  R\        \        ^
4      4      VR7      pV P	                  R^VR7      p\        R4      Vn        V P                  V P                  W#WEWg3R7      pRVn        VP                  4        VP                  4        V P                  VP                  ^4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP                   ^4       V P                  VP"                  R4       \        ^
4       F"  p	V P                  Wi,          V	^,          4       K$  	  V P                  VP                  \        R4      4       R	# )r  rJ  r\  r   r3  r   T      @
hellohelloNgUUUUUU?r_  gUUUUUU?r`  )r   r=   r>   r>  rm  r   r  r   r   r   rG  r   r   r   rn   r   r1  r2  )
rs   r  r1  r2  r?  r  ro  rF  r   r  s
   &&        r   test_sharedctypes#_TestSharedCTypes.test_sharedctypes  sN   #qt$(G$/*gD1D!QT*jjd59oDj9C$/W~LLA!#3NLO			"%qww0'*"suuc*rA""361Q3/ u\':;r   c                *    V P                  R R7       R# )TrJ  N)rL  r   s   &r   test_synchronize"_TestSharedCTypes.test_synchronize  s    D)r   c                   \        ^RR4      p\        V4      p^ Vn        ^ Vn        ^ Vn        V P                  VP                  ^4       V P                  VP                  R4       V P                  VP                  R4       R# )r   r/   Nr_  )r>  r   r1  r2  r?  rn   r   )rs   r  r  s   &  r   	test_copy_TestSharedCTypes.test_copy  sj    1c7#3i"suuc*(r   r\   Nrg  r`  )ry   rz   r{   r|   r   r  r"  rG  rL  rO  rR  r   r   r   s   @r   rB  rB    s8     "MC  <.*) )r   rB  z&requires multiprocessing.shared_memoryc                     a  ] tR tRt o Rt]R 4       tR tR tR t	R t
R tR tR	 tR
 t]P                   ! ]P$                  R8g  R4      R 4       t]P                   ! ]P$                  R8g  R4      R 4       tR tR tR tR tR t]P                   ! ]P$                  R8g  R4      R 4       t]P                   ! ]P$                  R8g  R4      R 4       tRtV tR# )_TestSharedMemoryi  c                    \        V \        4      '       d   \        P                  ! V 4      pMT pWP                  R \        V4      % VP                  4        R # r   )r   rq   r   SharedMemoryr  r   r    )shmem_name_or_objbinary_data	local_smss   && r   !_attach_existing_shmem_then_write3_TestSharedMemory._attach_existing_shmem_then_write  sD    '--%223DEI)I+6's;'(r   c                L    V\        \        P                  ! 4       4      ,           # r   )rq   rB   r   )rs   prefixs   &&r   _new_shm_name_TestSharedMemory._new_shm_name  s     BIIK(((r   c                \   V P                  R 4      p\        P                  ! VRRR7      pV P                  VP                  4       V P                  \        4      ;_uu_ 4        \        P                  ! VR,           RRR7       RRR4       \        P                  '       dZ   VP                  p VR,           Vn        V P                  \        4      ;_uu_ 4        VP	                  4        RRR4       W2n        R# R#   + '       g   i     L; i  + '       g   i     L-; i  Y2n        i ; i)test01_nullT   creaters  z aFN)	r_  r   rW  r  rG  ro   rE   
_USE_POSIX_name)rs   	name_tsmbsms	orig_names   &   r   *test_shared_memory_name_with_embedded_null<_TestSharedMemory.test_shared_memory_name_with_embedded_null  s    &&}5	((4cJ

#z**&&y5'8SQ +###		I&%-	&&z22JJL 3 &	 $ +* 32 &	s0   #!C=/+D# D+D# =D	D 	D# #D+c                   V P                  R 4      p\        P                  ! VRRR7      pV P                  VP                  4       V P                  VP                  V4       V P                  VP                  R4       V P                  \        VP                  4      VP                  4       V P                  VP                  \        V4      4       V P                  \        VP                  4      \        V4      4       ^*VP                  ^ &   V P                  VP                  ^ ,          ^*4       \        P                  ! V4      pV P                  VP                  ^ ,          ^*4       VP                  4        \        P                  ! V^VP                  ,          R7      pV P                  VP                  ^VP                  ,          4       VP                  4        V P                  \         4      ;_uu_ 4        \        P                  ! RRR7       RRR4       V P                  \         4      ;_uu_ 4        \        P                  ! RR7       RRR4       \"        P$                  P'                  R4      ;_uu_ 4       p\        P(                  pV P                  R	4      V P                  R
4      .pV Uu. uF  qV,           NK  	  ppWun        \        P                  ! R^R7      p	V P                  V	P                  4       V P                  V	P,                  V^ ,          4       Wun        \        P                  ! R^R7      p
V P                  V
P                  4       V P                  V
P,                  V^,          4       RRR4       \        P.                  '       d   V P                  R4      p\        P                  ! VRRR7      pV P                  \0        4      ;_uu_ 4         V P                  VP                  R4       \        P                  ! V4      pVP	                  4        VP                  4        VP                  4        VP	                  4         RRR4       V P                  \2        4      ;_uu_ 4        \        P                  ! VRRR7      pRRR4       \        P.                  '       dX    ! R R\        P                  4      pV! V4      pV P                  VP                  VP                  4       VP                  4        V P                  \0        4      ;_uu_ 4        \        P                  ! R4      pVP	                  4        RRR4       VP                  4        R#   + '       g   i     ELc; i  + '       g   i     EL:; iu upi   + '       g   i     EL"; i  TP	                  4        i ; i  + '       g   i     ELq; i  + '       g   i     ELF; i  + '       g   i     L; i)test01_tsmbTrc  rd  r  NFre  ,multiprocessing.shared_memory._make_filename	test01_fn	test02_fntest01_dblunlinkr  c                   P    ] tR tRt]P
                  ]P                  ,          tRtR# )O_TestSharedMemory.test_shared_memory_basics.<locals>.OptionalAttachSharedMemoryiD  r\   N)	ry   rz   r{   r|   rB   rT  O_RDWR_flagsr   r\   r   r   OptionalAttachSharedMemoryru  D  s    bii/r   rx  test01_notthere)r_  r   rW  r  rG  rn   r,   r  rs  r   r  rp   rq   r    
assertLessro   rE   rF   r  r  _SHM_NAME_PREFIXside_effectrg  rf  FileNotFoundErrorFileExistsError)rs   rh  ri  also_smssame_smsmock_make_filenameNAME_PREFIXnamesr,   shm1shm2name_dblunlinksms_unosms_duothere_can_only_be_one_smsrx  ok_if_exists_smsnonexisting_smss   &                 r   test_shared_memory_basics+_TestSharedMemory.test_shared_memory_basics  sI   &&}5	((4cJ

# 	9-#.CGGchh7 	chhC)c#((mSX. 
R( !--i8a"- !--ibkJr#(({3 z**&&d< + z**&&e4 +
 ]]  :< <?Q'88K''4d6H6H6UVE 5::ED4''EE:-2* --TBDOODKK(TZZq2-2* --TBDOODKK(TZZq2#<& ### "//0BCN#00G
 ""#455	%++GLL$?+88HGNN$MMOMMO NN$ 6 // )6(B(B)% 0 ###0]-G-G 09)D-22CHH=""$ 011+889JKO""$ 2 			c +** +** ;< < <T NN$ 655 0//0 21st   >U1<V7V:VB:V*W,A"V2WW0'W/1V	V	VV/	2WWW	W,	/W?	c                   \         P                  P                  R 4      ;_uu_ 4       p\        P                  pV P                  R4      V P                  R4      .pV Uu. uF  qBV,           NK  	  ppW1n        \        P                  ! R^R7      pV P                  VP                  4       V P                  VP                  V^ ,          4       W1n        \        P                  ! R^R7      pV P                  VP                  4       V P                  VP                  V^,          4       RRR4       R# u upi   + '       g   i     R# ; i)rp  	test03_fn	test04_fnTrd  N)rF   r  r  r   r|  r_  r}  rW  r  rG  rn   rg  )rs   r  r  r  r,   r  r  s   &      r   test_shared_memory_recreate-_TestSharedMemory.test_shared_memory_recreateR  s    ]]  :< <?Q'88K''4d6H6H6UVE 5::ED4''EE:-2* --TBDOODKK(TZZq2-2* --TBDOODKK(TZZq2#< < ;< < <s   7D9D40B:D94D99E
	c                   V P                  \        4      ;_uu_ 4        \        P                  ! R RR7      pRRR4       V P                  \        4      ;_uu_ 4        \        P                  ! R ^ R7      pRRR4       V P                  \        4      ;_uu_ 4        \        P                  ! R R7      pRRR4       R#   + '       g   i     L; i  + '       g   i     Lb; i  + '       g   i     R# ; i)Trd  Nro  rA   )ro   rE   r   rW  )rs   sms_invalids   & r   #test_invalid_shared_memory_creation5_TestSharedMemory.test_invalid_shared_memory_creationh  s    z**'44DrJK + z**'44DqIK + z**'44DAK +* +* +* +**s#   B<CC"<C	C	"C3	c           	     ~   \        \        P                  ^,           4       EF  pV P                  VR7      ;_uu_ 4        \        P
                  ! RRR7      pV P                  VP                  4       RVP                  R&   \        P                  ! W!R7      p\        P                  ! V4      pV P                  V\        P
                  4       V P                  VP                  VP                  4       V P                  \        VP                  R,          4      R4       V P                  \        VP                  R,          4      R4       RVP                  R&   V P                  \        VP                  R,          4      R4       V P                  \        VP                  R,          4      R4       R	VP                  R&   V P                  \        VP                  R,          4      R	4       V P                  \        VP                  R,          4      R	4       R
R
R
4       EK  	  R
#   + '       g   i     EK  ; i)r   protoTrc  rd     pickler   rt  Nprotocols   newvals   oldvalN)r  pickleHIGHEST_PROTOCOLr   r   rW  r  rG  r  dumpsloadsr   rn   r,   r   )rs   r  ri  pickled_smssms2s   &    r   "test_shared_memory_pickle_unpickle4_TestSharedMemory.test_shared_memory_pickle_unpickleu  s   622Q67EE**#003G

+( %ll3? ||K0%%dM,F,FG  4995  swws|!4i@  txx}!5yA  )  swws|!4i@  txx}!5yA )  swws|!4i@  txx}!5yA- +* 8***s   GH**H<c           
        \        \        P                  ^,           4       F  pV P                  VR7      ;_uu_ 4        \        P
                  ! RRR7      pRVP                  R&   \        P                  ! W!R7      pVP                  4        VP                  4        V P                  \        4      ;_uu_ 4        \        P                  ! V4       RRR4       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)	r   r  Trc  rd  r  r  r  N)r  r  r  r   r   rW  r  r  r    rG  ro   r~  r  )rs   r  ri  r  s   &   r   .test_shared_memory_pickle_unpickle_dead_object@_TestSharedMemory.test_shared_memory_pickle_unpickle_dead_object  s    622Q67EE**#003G($ll3? 		

&&'899LL- : +* 8 :9 +**s$   A<C::C'C:'C72C::Dc                h   \         P                  ! R RR7      pV P                  VP                  4       V P	                  V P
                  VP                  R3R7      pR Vn        VP                  4        VP                  4        V P                  \        VP                  R,          4      R4       V P	                  V P
                  VR3R7      pR Vn        VP                  4        VP                  4        V P                  \        VP                  R,          4      R4       VP                  4        R# )Trc  rd  s   howdyr   :Nr   Ns   HELLON)r   rW  r  rG  r   r[  r,   r   r   r   rn   r   r  r    )rs   ri  r   s   &  r   #test_shared_memory_across_processes5_TestSharedMemory.test_shared_memory_across_processes  s     ((3?

# LL99((H%  
 			swwr{+X6 LL99x  
 			swwr{+X6		r   r(   z#not feasible in non-posix platformsc                >   \         P                  P                  4       pVP                  4        VP	                  \        ^
4      4      p\        P                  ! VP                  P                  \        P                  4       VP	                  \        ^
4      4      pV P                  \        4      ;_uu_ 4        \        P                  ! \        P                  ! 4       \        P                  4       RRR4       VP                  4        R#   + '       g   i     L"; ir  )r   rQ  SharedMemoryManagerr   ShareableListr  rB   r  r  r	  rZ  r[  ro   r}  r   r   )rs   smmslsl2s   &   r   4test_shared_memory_SharedMemoryServer_ignores_sigintF_TestSharedMemory.test_shared_memory_SharedMemoryServer_ignores_sigint  s     &&::<		 uRy)
 	  &--0b	* 011GGBIIK/ 2 	 21s   99DD	zresource_tracker is posix onlyc                    R p\         P                  P                  P                  RV4      w  r#pV P	                  V4       R# )zif 1:
            from multiprocessing.managers import SharedMemoryManager


            smm = SharedMemoryManager()
            smm.start()
            sl = smm.ShareableList(range(10))
            smm.shutdown()
        r  N)r  r   r   r  r   r  s   &    r   >test_shared_memory_SharedMemoryManager_reuses_resource_trackerP_TestSharedMemory.test_shared_memory_SharedMemoryManager_reuses_resource_tracker  s;     ||11BB4M 	r   c                   \         P                  P                  4       pV P                  \        4      ;_uu_ 4        VP                  ^	R7       RRR4       VP                  4        \        ^^
4       Uu. uF  q!P                  \        V4      4      NK  	  pp\        ^ ^^4       Uu. uF  qAP                  VR7      NK  	  pp\        P                  ! V^ ,          P                  P                  R7      pV P                  \        V4      ^4       \        P
                  ! V^ ,          P                  R7      pV P                  \        VP                  4      ^ 4       V^ ,          P                  pVP!                  4        \"        P$                  R8w  d>   V P                  \&        4      ;_uu_ 4        \        P
                  ! VR7      p	RRR4       \         P                  P                  4       ;_uu_ 4       p
V
P                  R4      pV
P                  ^R7      pVP                  P                  pRRR4       \"        P$                  R8w  d@   V P                  \&        4      ;_uu_ 4        \        P                  ! VR7      pRRR4       R# R#   + '       g   i     ELK; iu upi u upi   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)r  r  Nr  r1   howdy)r   rQ  r  ro   rE   rW  r   r  r  r   shmr,   rn   r   r  r  r   r   r   r~  )rs   smm1r  lolr,  lomdoppleganger_list0doppleganger_shm0	held_name
absent_shmsmm2r  r  	absent_sls   &             r   -test_shared_memory_SharedMemoryManager_basics?_TestSharedMemory.test_shared_memory_SharedMemoryManager_basics  s   '';;=z**1% +

6;ArlDl""58,lD38S"3EG3Ea!!q!)3EG*88c!fjjooN/0!4)66CFKKH$5$9$9 :B?FKK	<<7" ""#455*77YG
 6 %%99;;t##G,B###-CI < <<7"""#455)77YG	 65 #- +** EG 65 <;
 655s;   J5"J%(J*3J/9:K-KJ"	/J?	K	K&	c           	         \         P                  ! . RO4      pV P                  VP                  P                  4       V P                  VP                  P                  \        V4      4       V P                  \        \        V4      4      \        V4      4       V P                  \        4      ;_uu_ 4        V^,           RRR4       V P                  \        4      ;_uu_ 4        ^V^&   RRR4       VP                  ^ 4      pR V^ &   V P                  W!P                  ^ 4      4       V P                  VP                  R4       V P                  \        V4      ^4       \        P                   ! 4       ;_uu_ 4        \        P"                  ! R4       V P                  \$        4      ;_uu_ 4        VP'                  R4       RRR4       V P                  VP'                  ^d4      ^4       RRR4       V P                  V^ ,          R 4       V P                  VR,          R4       V P                  \)        V4      R4       ^*V^&   V P                  V^,          ^*4       RV^&   V P                  V^,          R4       V P                  VP                  R4       V P+                  \$        R	4      ;_uu_ 4        R
V^&   RRR4       V P                  V^,          R4       RV^ &   V P                  V^ ,          R4       V P                  V^,          R4       V P+                  \$        R	4      ;_uu_ 4        RV^ &   RRR4       V P                  V^,          R4       V P+                  \$        R	4      ;_uu_ 4        RV^&   RRR4       V P                  V^,          R4       \        P                   ! 4       ;_uu_ 4        \        P"                  ! R4       V P                  VP-                  ^*4      ^4       V P                  VP-                  R4      ^4       V P                  VP-                  R4      ^ 4       RRR4       V P/                  R4      p\         P                  ! WR7      p V P1                  VP                  P                  VP                  P                  4       V P                  W4P                  P                  4       V P                  \        V4      \        V4      4       V P                  VP                  VP                  4       ^MVR&   V P                  VR,          ^M4       V P1                  VR,          ^M4       VP                  P3                  4        VP                  P	                  4        \         P                  ! VP                  P                  R7      pV P                  VP                  P                  VP                  P                  4       RVR&   V P                  VR,          R4       VP                  P3                  4        VP                  P3                  4        \         P                  ! 4       p V P                  \        V4      ^ 4       V P                  VP                  R4       V P                  VP-                  R4      ^ 4       V P                  \$        4      ;_uu_ 4        VP'                  R4       RRR4       VP                  P3                  4        VP                  P	                  4        R#   + '       g   i     ELV; i  + '       g   i     EL?; i  + '       g   i     EL{; i  + '       g   i     ELf; i  + '       g   i     EL; i  + '       g   i     ELA; i  + '       g   i     EL; i  + '       g   i     ELl; i  TP                  P	                  4        i ; i  + '       g   i     EL; i  TP                  P	                  4        i ; i)r     HoWdYNTz8s8sdqxxxxxx?xxxxxxxx?qignore100somez8s8sdq8sxxxxxxx?qzexceeds available storagezfar too manyu   encodésu	   encodéess	   123456789s   adiostest03_duplicater  ip  rU  any)r  r  gX9vqrO  NTr  rz  rA   )r   r  r  r  rG  rp   r,   rq   r   ro   
IndexError_get_packing_formatrn   r   r   warningscatch_warningssimplefilterrE   r  r   r  r  r_  rE  r    )rs   r  current_formatname_duplicatesl_copysl_tetheredempty_sls   &      r   'test_shared_memory_ShareableList_basics9_TestSharedMemory.test_shared_memory_ShareableList_basics  s   ((>
 	& 	bffkk3r7+c$r(mSW- z**qE + z**BqE + //21)?)?)BC 	$=> 	R!$ $$&&!!(+"":.. /RXXc]A. ' 	A(B& 	"I>	
 1A#1A'$78##J$?A A"BqEA 	A'1A
+A)##J$?A ABqEA 	A)##J$?A A BqEA 	A) $$&&!!(+RXXb\1-RXXh/3RXXh/3 ' ++,>?--bF
	!W[[-=-=>^[[-=-=>T"XtG}5RYY7GBKWR["-2+KKKK  $11rvv{{Ckoo&:&:;BB%
 !..0	"S]A.X__b1X^^E2A6"":..t$ /LL LL!I +** +**$ /.. '&&.A A AA A AA A A '&&( KK " /.. LL!s   7
\&\">4]
2\6	)]
8]4]29^=A:^(C:^. 	A5_! >_"_! \	"\3	6]	]

]	]/	2^	^	^+	._
_		_! !_=c           	     P   \        \        P                  ^,           4       EF  pV P                  VR7      ;_uu_ 4        \        P
                  ! \        ^
4      4      pV P                  VP                  P                  4       \        P                  ! W!R7      p\        P                  ! V4      pV P                  V\        P
                  4       V P                  VR,          ^	4       V P                  W$4       RV^&   V P                  V^,          R4       RV^&   V P                  V^,          R4       \        P
                  ! \        R4      4      pV P                  VP                  P                  4       \        P                  ! WQR7      pV P                  \        V4      \        V4      4       VP                  P                  4        VP                  P                  4        VP                  P                  4        RRR4       EK  	  R#   + '       g   i     EK  ; i)r   r  r  changednewvaluei  NrA   )r  r  r  r   r   r  r  r  rG  r  r  r   rn   assertIsNotr   r    )rs   r  r  serialized_sldeserialized_sl	larger_slserialized_larger_sls   &      r   )test_shared_memory_ShareableList_pickling;_TestSharedMemory.test_shared_memory_ShareableList_picklingv  s   622Q67EE**"00r;. &R @"(,,}"=%%#]%@%@B  !4a8  5%."  A	2"1  !3Z@)77c
C		 4 45'-||I'N$  ]!3S9M5NO##%##))+/ +* 8***s   GHH%c           
     4   \        \        P                  ^,           4       F  pV P                  VR7      ;_uu_ 4        \        P
                  ! \        ^
4      4      p\        P                  ! W!R7      pVP                  P                  4        VP                  P                  4        V P                  \        4      ;_uu_ 4        \        P                  ! V4       RRR4       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)r   r  r  N)r  r  r  r   r   r  r  r  r    rG  ro   r~  r  )rs   r  r  r  s   &   r   5test_shared_memory_ShareableList_pickling_dead_objectG_TestSharedMemory.test_shared_memory_ShareableList_pickling_dead_object  s    622Q67EE**"00r; &R @ &&'899LL/ : +* 8 :9 +**s$   BDC3D3D>DDc                   R p\         P                  ! \        P                  RRV.\         P                  \         P                  R7      ;_uu_ 4       pVP
                  P                  4       P                  4       P                  4       pVP                  4        VP                  4        Rp\        P                  ! \        P                  V4       F  p \        P                  ! VRR7      pK  	  \"        P$                  R8X  dU   \&        P(                  ! RV 2R	4       VP*                  P-                  4       P                  4       pV P/                  R
V4       RRR4       R#   \          d      K  i ; i  + '       g   i     R# ; i)aX  if 1:
            import os, time, sys
            from multiprocessing import shared_memory

            # Create a shared_memory segment, and send the segment name
            sm = shared_memory.SharedMemory(create=True, size=10)
            sys.stdout.write(sm.name + '\n')
            sys.stdout.flush()
            time.sleep(100)
        -Er  r  zIA SharedMemory segment was leaked after a process was abruptly terminatedFro  r(   /r   z[resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdownN)
subprocessPopenr   r   PIPEr  readlinestripdecoder'  r   r   r:  r%  r   rW  r~  rB   r,   r)   
unregisterr  rJ  rp   )rs   r  r   r,   err_msgr  r  rt   s   &       r   4test_shared_memory_cleaned_after_process_terminationF_TestSharedMemory.test_shared_memory_cleaned_after_process_termination  s6   	 s~~tT3?%/__%/__6 69:88$$&,,.557D KKMFFH;G++G,@,@'J'44T%HC K ww'! !++avJH
 hhmmo,,.DEHJ=6 6 ) 6 6 6s2   BE6E#,A-E6#E3	.E62E3	3E66F	c                   R p\         P                  ! R^
R7      p \        P                  ! RWP                  4      w  r4pV P                  RV4       V P                  V^ 4       \         P                  ! RVP                  R7      pVP                  4         VP                  4        VP                  4        R#   \         d     Li ; i   TP                  4        M  \         d     Mi ; iTP                  4        i ; i)zif 1:
            import sys
            from multiprocessing.shared_memory import SharedMemory
            mem = SharedMemory(create=False, name=sys.argv[1], track=False)
            mem.close()
        Trd  r  s   resource_trackerF)re  r,   N)
r   rW  r   r  r,   r8  rn   r    rG  r  )rs   r  memr  r  rt   mem2s   &      r   test_shared_memory_untracking/_TestSharedMemory.test_shared_memory_untracking  s    
 ((2>	(99$XXNLBS0#6R# --UJDJJL

 IIK  

 IIKsB   A:C
 B9 9CC
C?CC?C+(C?*C++C?c                $   R p\         P                  ! R^
R7      p \        P                  ! RWP                  4      w  r4pV P                  V^ 4       V P                  RV4        VP                  4        \        P                  ! VP                  R4       VP                  4        R#   \         d     L@i ; i   TP                  4        M  \         d     Mi ; i\        P                  ! TP                  R4       TP                  4        i ; i)zif 1:
            import sys
            from multiprocessing.shared_memory import SharedMemory
            mem = SharedMemory(create=False, name=sys.argv[1], track=True)
            mem.close()
        Trd  r  s[   resource_tracker: There appear to be 1 leaked shared_memory objects to clean up at shutdownr   N)r   rW  r   r  r,   rn   rp   rG  r  r)   r  rg  r    )rs   r  r  r  r  rt   s   &     r   test_shared_memory_tracking-_TestSharedMemory.test_shared_memory_tracking  s    
 ((2>	(99$XXNLBSR#MMABEG

 ''		?CIIK  

 ''		?CIIKsB   AB9 %B( (B65B69D;CDCDC5Dr\   Nrg  )ry   rz   r{   r|   r   r%  r[  r_  rk  r  r  r  r  r  r  rF   r~   rB   r,   r  r  r  r  r  r  r  r  r  r   r   r   s   @r   rU  rU    s     #M )&n`3,BB4.8 __RWW')NO P. __RWW')IJ K(H<o"b60+JZ __RWW')IJ K4 __RWW')IJ Kr   rU  c                   v   a  ] tR tRt o R
tR tR t]R 4       tR t	]
P                  ! R4      R 4       tRtV tR	# )_TestFinalizei  c                    \         P                  P                  4       V n        \         P                  P	                  4        R # r   )r   _finalizer_registryr   registry_backupr  r   s   &r   r  _TestFinalize.setUp	  s+    #77<<>  &&(r   c                    \         P                  ! 4        V P                  \        P                  4       \        P                  P                  V P                  4       R # r   )r  r  r   r   r  r  r  r   s   &r   r  _TestFinalize.tearDown  s9    


112  ''(<(<=r   c                    ! R  R\         4      pV! 4       p\        P                  ! W1P                  RR7       ?\        P
                  ! 4        V! 4       p\        P                  ! WAP                  RR7      pV! 4        V! 4        ?\        P
                  ! 4        V! 4       p\        P                  ! WaP                  RR7       V! 4       p\        P                  ! WqP                  R^R7       V! 4       p\        P                  ! WP                  R	^ R7       V! 4       p	\        P                  ! WP                  R
^ R7       V! 4       p
\        P                  ! WP                  R^ R7       \        P                  ! RVP                  RRR7       \        P                  ! RVP                  RRR7       \        P                  ! 4        VP                  4        \        P                  ! ^ 4       R# )c                       ] tR tRtRtR# ))_TestFinalize._test_finalize.<locals>.Fooi  r\   Nr  r\   r   r   r  r        r   r  r\  )rQ   exitpriorityN)r   )r   )r   )d10)d01)d02)d03)r<  i)STOPi)
r  r   Finalizer  r  r  _exit_functionr    rB   _exit)r   r'  r  r   r   close_br   r  r	  r
  r  s   &&         r   _test_finalize_TestFinalize._test_finalize  s9   	& 	 Ea0


E--996:		


Ea0ec998!Dec998!Dec998!Dec998!DdDIIFEdDIIIDI 	


r   c                .   V P                  4       w  rV P                  V P                  V3R 7      pRVn        VP	                  4        VP                  4        \        VP                  R4       Uu. uF  qDNK  	  ppV P                  V. RO4       R# u upi )r   Tr  N)r   r   r  r  r
  r	  r<  )	r  r   r  r   r   r   r-  r  rn   )rs   r'  r)  r   r  r  s   &     r   test_finalize_TestFinalize.test_finalize:  sz    99;LL 3 3:-LH			!%dii!89!8##!89!LM :s   0
Br   c                $  aaaa	 R  o ! V3R lR\         4      oRo	RoVV	3R lpVVV	3R lp\        P                  ! 4       p\        P                  ! 4       p \
        P                  ! R4       \        P                  ! ^^^4       \        P                  ! VR7      \        P                  ! VR7      .p\        P                  ! V4      ;_uu_ 4        \        P                  ! R	4       R
o	RRR4       Se   Sh \        P                  ! V4       \        P                  ! V!   \        P                  ! 4        R#   + '       g   i     LX; i  \        P                  ! T4       \        P                  ! T!   \        P                  ! 4        i ; i)c                      R # r   r\   r\   r   r   cb,_TestFinalize.test_thread_safety.<locals>.cbH      r   c                   .   <a  ] tR tRt o V3R ltRtV tR# )-_TestFinalize.test_thread_safety.<locals>.FooiK  c                p   < W n         \        P                  ! V S\        P                  ! ^^d4      R7       R# )r   )r  N)r  r   r  r!  randint)rs   r  s   &r   r   6_TestFinalize.test_thread_safety.<locals>.Foo.__init__L  s#    dBV^^As5KLr   )r  N)ry   rz   r{   r|   r   r   r   )r   r  s   @r   r  r  K  s     M Mr   r  FNc                     < S'       gI   \         P                  ! \        P                  ! 4       R ,          4        \        P                  ! 4        KP  R#   \
         d   p T o Rp ? Ke  Rp ? ii ; ir  )r   r-  r!  r   _run_finalizersrk   )r<  rw  finishs    r   run_finalizers8_TestFinalize.test_thread_safety.<locals>.run_finalizersT  sL    

6==?T12 ((*  ! Cs   A A,A''A,c                     < / p S'       g;    \        ^
4       Uu0 uF
  pS! 4       kK  	  upV \        P                  ! ^4      &   KB  R# u upi   \         d   pToT P	                  4         Rp?Kl  Rp?ii ; ir  )r  r!  getrandbitsrk   r  )r\  r  r<  r  rw  r"  s      r   make_finalizers9_TestFinalize.test_thread_safety.<locals>.make_finalizers_  si    A @ERy/Iy!y/IAf((+,	  0J  CGGIIs'   A AA A A5A00A5gư>r   rJ  T)r  r   getswitchintervalr  r7  r   setswitchintervalr8  rA  r  r	   start_threadsr   r-  r  )
rs   r#  r'  old_intervalold_thresholdr   r  r  rw  r"  s
   &     @@@@r   test_thread_safety _TestFinalize.test_thread_safetyE  s"   		M& 	M 		
	 ,,.((*	%%d+Q1% ''~> ''?AG!//88

3 9 	  !!,/m,JJL 98 !!,/m,JJLs&   A:E D;+E ;E	E AF)r  Nrg  )ry   rz   r{   r|   r   r  r  r"  r  r  r   r!  r.  r   r   r   s   @r   r  r    sN     "M)>
 % %N	N u%4 &4r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )_TestImportStari  c                "   ^ RI p\        P                  P                  \        P
                  4      p\        P                  P                  VP                  V4      R4      pVP                  V4      pV Uu. uFM  p\        P                  P                  \        P                  P                  V4      ^,          4      ^ ,          NKO  	  ppV Uu. uF  pRV,           NK  	  ppVP                  R4       VP                  R4       V# u upi u upi )r   Nz*.pyzmultiprocessing.zmultiprocessing.__init__r   )globrB   r   dirnamer   __file__r   escapesplitextsplitr  r  )rs   r3  folderpatternfilesrL  modulesr  s   &       r   get_module_names _TestImportStar.get_module_names  s    !9!9:'',,t{{62F;		'"EJKU277##BGGMM!$4Q$78;;UK3:;7a%))7;12()	 L;s   6ADDc                
   V P                  4       p\        P                  R 8X  d5   VP                  R4       VP                  R4       VP                  R4       M.VP                  R4       \        '       g   VP                  R4       \
        f   VP                  R4       V F\  p\        V4       \        P                  V,          pV P                  VRV4       VP                   F  pV P                  W44       K  	  K^  	  R# )r1   zmultiprocessing.popen_forkz multiprocessing.popen_forkserverz!multiprocessing.popen_spawn_posixz!multiprocessing.popen_spawn_win32Nzmultiprocessing.sharedctypes__all__)
r=  r   r   r  r  r<   r  r<  r  r@  )rs   r<  r,   modattrs   &    r   test_import_TestImportStar.test_import  s    '')<<7"NN78NN=>NN>?NN>? =AB=NN9:Dt++d#CsIt4""3- $	 r   r\   N)ry   rz   r{   r|   r=  rC  r   r   r   s   @r   r1  r1    s     	. .r   r1  c                   F   a  ] tR tRt o RtR t]R 4       tR tR t	Rt
V tR# )	_TestLoggingi  c                    \         P                  ! 4       pVP                  \        P                  4       V P                  V4       VP                  R 4       VP                  R4       VP                  \        4       R# )zthis will not be printedznor will thisN)	r   
get_loggersetLevelr   
SUBWARNINGr  debuginfo	LOG_LEVEL)rs   loggers   & r   test_enable_logging _TestLogging.test_enable_logging  sS     ++-(V$/0O$	"r   c                n    \         P                  ! 4       pVP                  VP                  4       4       R # r   )r   rH  r  getEffectiveLevel)r   r'  rN  s   && r   _test_level_TestLogging._test_level  s%     ++-		&**,-r   c                0   ^ p^%p\         P                  ! 4       p\        P                  ! 4       pVP                  p\         P
                  ! RR7      w  rgVP                  V4       V P                  V P                  V3R7      pVP                  4        V P                  WP                  4       4       VP                  4        VP                  4        VP                  \        P                  4       VP                  V4       V P                  V P                  V3R7      pVP                  4        V P                  W&P                  4       4       VP                  4        VP                  4        VP                  V4       VP                  \        R7       R# )r%  Fr  r   )levelN)r   rH  logging	getLoggerrV  r  rI  r   rS  r   rn   r  r   r    NOTSETrM  )	rs   LEVEL1LEVEL2rN  root_logger
root_levelro  rp  r   s	   &        r   
test_level_TestLogging.test_level  s    ++-'') &&
(--U;LL 0 0yLA		/			'V$LL 0 0yLA		/			Z(i(r   c                z   \         P                  ! 4       pVP                  p VP                  \        P
                  4       \        P                  ! 4       p\        P                  ! V4      pR pVP                  \        P                  ! V4      4       VP                  V4       VP                  R4       \        P                  ! R4       VP                  R4       \        P                   P#                  \$        4      pVP'                  4       pV P)                  RV R2V4       V P)                  RV R2V4       V P)                  RV R2V4       VP                  V4       VP+                  V4       VP-                  4        R	#   TP                  T4       TP+                  X4       TP-                  4        i ; i)
z*[%(levelname)s] [%(filename)s] %(message)sr   23z[INFO] [z] 1z] 2z	[DEBUG] [z] 3N)r   rH  rV  rI  r   DEBUGr  r  rW  StreamHandlersetFormatter	Formatter
addHandlerrL  rK  rB   r   basenamer5  rv  rp   removeHandlerr    )rs   rN  original_levelr  ri  logging_formatfilename
log_records   &       r   test_filename_TestLogging.test_filename  sG    ++-	OODJJ'[[]F++F3GIN  !2!2>!BCg&KKIIcNLLww''1H*JMMHXJc2J?MMHXJc2J?MMIhZs3Z@OON+  )MMO OON+  )MMOs   D/F 4F:r\   Nrg  )ry   rz   r{   r|   r   rO  r"  rS  r^  rn  r   r   r   s   @r   rF  rF    s2     "M# . .)8 r   rF  c                   t   a  ] tR tRt o Rt]R 4       t]P                  ! ]	! ]
R4      R4      R 4       tRtV tR# )	_TestPollEintri  c                |    \         P                  ! R 4       \        P                  ! V\        P
                  4       R# r  )r   r-  rB   r  rZ  SIGUSR1)r   r	  s   &&r   _killer_TestPollEintr._killer  s    

3
V^^$r   rs  requires SIGUSR1c                  a R .oV3R lp\         P                  ! 4       p\        P                  ! \        P                  V4      p V P	                  V P
                  V3R7      pVP                  4         V P	                  \        P                  RR7      pVP                  4        VP                  4        VP                  4        V P                  S^ ,          4       V P                  VP                  ^ 4       \        P                  ! \        P                  V4       R#   TP                  4        i ; i  \        P                  ! \        P                  T4       i ; i)Fc                     < R S^ &   R# r  r\   )rQ   
got_signals   *r   record._TestPollEintr.test_poll_eintr.<locals>.record  s     JqMr   r   N)r   )rB   r   rZ  rs  r   rt  r   r   r-  r   r   rn   r   )rs   rz  r	  
oldhandlerkillerr   ry  s   &     @r   test_poll_eintr_TestPollEintr.test_poll_eintr  s    W
	!iik]]6>>6:
	6\\SF\CFLLNLL

L>	OOJqM*QZZ+MM&..*5	  MM&..*5s&   .D6 5AD! 6AD6 !D33D6 6'Er\   Nrg  )ry   rz   r{   r|   r   r"  rt  rF   r#  rk  rZ  r~  r   r   r   s   @r   rq  rq    sF     "M% % 35GH6 I6r   rq  c                   R   a  ] tR tRt o ]P
                  ! ]R4      R 4       tRtV t	R# )TestInvalidHandlei&  skipped on Windowsc                $   \         P                  P                  R 4      p VP                  4        RVn        V P                  \        \
        3\         P                  P                  R4       R#   \        \
        3 d     LQi ; i  RTn        i ; i)iMNrA   )r   r  
Connectionr$  rE   r  _handlero   r  s   & r   test_invalid_handles&TestInvalidHandle.test_invalid_handles(  sy    ))44X>	 IIK  DL:w/)44??	E G$ 		
  DLs#   A/ /B B BB 	Br\   N)
ry   rz   r{   r|   rF   r~   WIN32r  r   r   r   s   @r   r  r  &  s%     __U01E 2Er   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )	OtherTesti9  c                     ! R  R\         4      pV P                  \        P                  \        P                  P
                  V! 4       R4       R# )c                   ,   a  ] tR tRt o R tR tRtV tR# )FOtherTest.test_deliver_challenge_auth_failure.<locals>._FakeConnectioni=  c                    R # )   something bogusr\   rs   rs  s   &&r   rY  QOtherTest.test_deliver_challenge_auth_failure.<locals>._FakeConnection.recv_bytes>  s    )r   c                    R # r   r\   rs   r  s   &&r   r[  QOtherTest.test_deliver_challenge_auth_failure.<locals>._FakeConnection.send_bytes@      r   r\   N)ry   rz   r{   r|   rY  r[  r   r   r   s   @r   _FakeConnectionr  =  s     * r   r     abcN)r  ro   r   r  r  deliver_challengers   r  s   & r   #test_deliver_challenge_auth_failure-OtherTest.test_deliver_challenge_auth_failure<  s=    	f 	
 	/==)44FF)+V	5r   c                     ! R  R\         4      pV P                  \        P                  \        P                  P
                  V! 4       R4       R# )c                   2   a  ] tR tRt o R tR tR tRtV tR# )EOtherTest.test_answer_challenge_auth_failure.<locals>._FakeConnectioniG  c                    ^ V n         R# r   r  r   s   &r   r   NOtherTest.test_answer_challenge_auth_failure.<locals>._FakeConnection.__init__H  s	    
r   c                    V ;P                   ^,          un         V P                   ^8X  d   \        P                  P                  # V P                   ^8X  d   R# R# )r   r  r   )r  r   r  
_CHALLENGEr  s   &&r   rY  POtherTest.test_answer_challenge_auth_failure.<locals>._FakeConnection.recv_bytesJ  s=    

a
::?*55@@@ZZ1_-r   c                    R # r   r\   r  s   &&r   r[  POtherTest.test_answer_challenge_auth_failure.<locals>._FakeConnection.send_bytesQ  r  r   r  N)	ry   rz   r{   r|   r   rY  r[  r   r   r   s   @r   r  r  G  s      r   r  r  N)r  ro   r   r  r  answer_challenger  s   & r   "test_answer_challenge_auth_failure,OtherTest.test_answer_challenge_auth_failureF  s=    	f 	 	/==)44EE)+V	5r   r\   N)ry   rz   r{   r|   r  r  r   r   r   s   @r   r  r  9  s     55 5r   r  md5c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )ChallengeResponseTestiX  s   supadupasecretkeyc                V    \         P                  P                  V P                  V4      # r   )r   r  _create_responser   )rs   messages   &&r   create_response%ChallengeResponseTest.create_response]  s$    ))::LL'
 	
r   c                V    \         P                  P                  V P                  W4      # r   )r   r  _verify_challenger   )rs   r  responses   &&&r   verify_challenge&ChallengeResponseTest.verify_challengeb  s$    ));;LL'
 	
r   c                z   R F  pV P                  RV: 24      ;_uu_ 4        RpV'       d   RVP                  R4      ,          pMRpW2,           pV P                  V4      pVP                  V4      '       g   V P	                  V4       V P                  W$4       R R R 4       K  	  R #   + '       g   i     K  ; i)Nzalgo=s   is-twenty-bytes-longs   {%s}r  r   )Nr  r-  )r   r   r  
startswithrl   r  )rs   algor\  r^  r  s   &    r   test_challengeresponse,ChallengeResponseTest.test_challengeresponseg  s    +Dj))-$t{{7';;F Fl//4**622IIh'%%c4 *) ,)))s   A8B))B:r\   N)
ry   rz   r{   r|   r   r  r  r  r   r   r   s   @r   r  r  X  s       #G



5 5r   r  c                 8    V ;P                   ^,          un         R# r   )r  )nss   &r   initializerr    s    GGqLGr   c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )TestInitializersi  c                    \         P                  ! 4       V n        V P                  P                  4       V n        ^ V P                  n        R# r   )r   r  rD  r  r  r  r   s   &r   r  TestInitializers.setUp  s1    "**,(($$&r   c                n    V P                   P                  4        V P                   P                  4        R # r   rG  r   s   &r   r  TestInitializers.tearDown  rI  r   c                R   \         P                  P                  4       pV P                  \        VP
                  ^4       VP                  \        V P                  34       V P                  V P                  P                  ^4       VP                  4        VP                  4        R# r   )r   rQ  SyncManagerro   	TypeErrorr   r  r  rn   r  r   r   )rs   r  s   & r   test_manager_initializer)TestInitializers.test_manager_initializer  sj    $$002)QWWa0	dggZ(q)	

	r   c                ,   V P                  \        \        P                  ^R7       \        P                  ! ^\        V P
                  34      pVP                  4        VP                  4        V P                  V P
                  P                  ^4       R# )r   )r  N)
ro   r  r   r  r  r  r    r   rn   r  rc  s   & r   test_pool_initializer&TestInitializers.test_pool_initializer  sa    )_%9%9qI  K$''<			q)r   )rD  r  N)
ry   rz   r{   r|   r  r  r  r  r   r   r   s   @r   r  r    s     
* *r   r  c                 d     V P                  R R7      pR#   \        P                   d     R# i ; i)F)blockN)r   r|  r  )r   items   & r   _this_sub_processr    s-    uu5u!== s    //c                      \         P                  ! 4       p \         P                  ! \        V 3R 7      pRVn        VP                  4        VP                  4        R# r   TN)r   r   r   r  r   r   r   )r#   subProcs     r   _test_processr    s>    !!#E%%->eXNGGNMMOLLNr   c                     W ,          # r   r\   r  s   &r   _afuncr    r  r   c                      \         P                  ! ^R7      p V P                  \        . RO4      pV P	                  4        V P                  4        R# )rc   rg  N)r   r   r^  rc   r   rt  rh  )r   r  r  r  r    r   )r  r1  s     r   pool_in_processr    s5    !,D./AJJLIIKr   c                   B   a  ] tR tRt o R t]R 4       tR tR tRt	V t
R# )
_file_likei  c                     Wn         R V n        R # r   )	_delegate_pid)rs   delegates   &&r   r   _file_like.__init__  s    !	r   c                ~    \         P                  ! 4       pWP                  8w  d   Wn        . V n        V P                  # r   )rB   r   r  _cacher  s   & r   cache_file_like.cache  s-    iik))IDK{{r   c                <    V P                   P                  V4       R # r   )r  r  r  s   &&r   r  _file_like.write  s    

$r   c                |    V P                   P                  R P                  V P                  4      4       . V n        R# )rU  N)r  r  r   r  r  r   s   &r   flush_file_like.flush  s(    RWWTZZ01r   )r  r  r  N)ry   rz   r{   r|   r   propertyr  r  r  r   r   r   s   @r   r  r    s-         r   r  c                   2   a  ] tR tRt o R tR tR tRtV tR# )TestStdinBadfiledescriptori  c                |    \         P                  ! \        R 7      pVP                  4        VP	                  4        R# rx  )r   r   r  r   r   )rs   r  s   & r   test_queue_in_process0TestStdinBadfiledescriptor.test_queue_in_process  s$    &&m<

		r   c                |    \         P                  ! \        R 7      pVP                  4        VP	                  4        R# rx  )r   r   r  r   r   rc  s   & r   test_pool_in_process/TestStdinBadfiledescriptor.test_pool_in_process  s$    ##?;			r   c                   a \         P                  ! 4       p\        V4      oSP                  R 4       \        P
                  ! V3R lR7      pSP                  4        R# )r  c                  $   < S P                  4       # r   )r  )flikes   r   rI  :TestStdinBadfiledescriptor.test_flushing.<locals>.<lambda>  s    ekkmr   r   N)r  r  r  r  r   r   r  )rs   sior  r  s   &  @r   test_flushing(TestStdinBadfiledescriptor.test_flushing  s=    kkm3E&&.CDr   r\   N)	ry   rz   r{   r|   r  r  r  r   r   r   s   @r   r  r    s     

' 'r   r  c                      a  ] tR tRt o ]R 4       tRR lt]R 4       tRR ltR t	R t
]P                  ! R4      R	 4       t]R
 4       t]P                  ! R4      R 4       tR tRtV tR# )TestWaiti  c                   \        ^
4       Fa  pV'       d1   \        P                  ! \        P                  ! 4       R,          4       VP	                  V\
        P                  ! 4       34       Kc  	  VP                  4        R# )r  r   N)r  r   r-  r!  r  rB   r   r    )r   rQ  slowr  s   &&& r   _child_test_waitTestWait._child_test_wait  sL    rA

6==?U23FFAryy{#$  	
	r   c                  a ^ RI Hp . p. o. p\        ^4       F  p\        P                  ! RR7      w  rg\        P
                  ! V P                  Wq3R7      pRVn        VP                  4        VP                  4        VP                  V4       SP                  V4       V P                  VP                  4       K  	  V'       d4   V! V4       F%  p VP                  4       p	VP                  V	4       K'  	  K;  VP!                  4        \#        V3R l\        ^
4       4       4      p
V P%                  WJ4       R#   \         d&    TP                  T4       TP                  4         K  i ; i)r   r   Fr  r   Tc              3   P   <"   T F  pS F  q!VP                   3x  K  	  K  	  R # 5ir   )r	  )r  r  r   r  s   &  r   r  %TestWait.test_wait.<locals>.<genexpr>  s     GiAaee**is   #&N)multiprocessing.connectionr   r  r   r  r   r  r   r   r    r  r  r   r  rh  r  r(  r  rn   )rs   r  r   readersmessagesr  rh  rQ  r   r\  r  r  s   &&         @r   	test_waitTestWait.test_wait  s   3qA"''u5DA''t/D/DA9UAAHGGIGGINN1LLOOOAFF#  '])&&(C
 OOC( # 	GeBiGG,   NN1%GGIs   D<<,E,+E,c                T   \         P                   ! 4       pVP                  V4       \        ^
4       Fb  pV'       d1   \        P                  ! \
        P
                  ! 4       R,          4       VP                  RV,          P                  R4      4       Kd  	  VP                  4        R# )r  r   %s
r  N)	r  r   r  r   r-  r!  r  r   r    )r   r  r  r   r  s   &&&  r   _child_test_wait_socket TestWait._child_test_wait_socket  sg    MMO			'rA

6==?U23IIvz))'23  	
	r   c                   ^ RI Hp \        P                  ! \        P
                  ^ 34      pVP                  4       p. p. p/ p\        ^4       Fi  p\        P                  ! V P                  WA3R7      p	RV	n        V	P                  4        VP                  V	4       V P                  V	P                  4       Kk  	  \        ^4       F*  pVP!                  4       w  rVP                  V
4       . Wz&   K,  	  VP#                  4        V'       de   V! V4       FV  p
V
P%                  ^ 4      pV'       g$   VP'                  V
4       V
P#                  4        K?  Wz,          P                  V4       KX  	  Kl  RP                  R \        ^
4       4       4      P)                  R4      pVP+                  4        F$  pV P-                  RP                  V4      V4       K&  	  R# )	r   r   r   TrU  c              3   4   "   T F  pR V,          x  K  	  R# 5i)r	  Nr\   r  s   & r   r  ,TestWait.test_wait_socket.<locals>.<genexpr>4  s     9y!6A::ys   r  r   N)r	  r   r  r  r   r'  r  r  r   r   r		  r   r   r  r  r   r  r    r  r  r   r;  rn   )rs   r  r   r  r  r	  r  dicr  r   rh  r  r\  r  vs   &&             r   test_wait_socketTestWait.test_wait_socket  s\   3  -"4"4a!89}}qA''t/K/K.2\;AAHGGILLOOOAFF#  qA88:DANN1CF  	
	']ffRjNN1%GGIFMM#& # 779uRy99@@IASXXa[(3 r   c                (    V P                  R 4       R# r  )r	  r   s   &r   test_wait_slowTestWait.test_wait_slow8  s    tr   c                (    V P                  R 4       R# r  )r	  r   s   &r   test_wait_socket_slowTestWait.test_wait_socket_slow;  s    d#r   r  c                p   ^ RI Hp Rp\        P                  ! 4       w  r4\        P
                  ! 4       pV! W4.V4      p\        P
                  ! 4       V,
          pV P                  V. 4       V P                  Wr\        ,
          4       VP                  R4       V! W4.^4      pV P                  Wc.4       R# )r   r   r/   N)
r	  r   r   r  r   r   rn   r  rp  r  )rs   r   r5   r   r   r   r   r  s   &       r   test_wait_timeoutTestWait.test_wait_timeout>  s    3##% A67# 5(b!5I"56	tA62c"r   c                R    VP                  4        \        P                  ! V4       R # r   )r  r   r-  )r   r%  periods   &&&r   signal_and_sleepTestWait.signal_and_sleepP  s    

6r   c                   ^ RI Hp ^pR p\        P                  ! ^ 4      p\        P                  ! 4       w  rV\        P
                  ! V P                  WB3R7      pVP                  4        V P                  VP                  \        4       V P                  VP                  ^R7      4       \        P                  ! 4       pV! WWP                  V.V^,           4      p	\        P                  ! 4       V,
          p
V P                  WP                  .4       V P!                  W^,           4       V P#                  W^,
          4       VP%                  R4       \        P                  ! 4       pV! WWP                  V.^4      p	\        P                  ! 4       V,
          p
V P                  V! V	4      V! VP                  V.4      4       V P!                  V
R4       VP%                  R4       \        P                  ! 4       pV! WWP                  V.^4      p	\        P                  ! 4       V,
          p
V P                  V! V	4      V! WWP                  V.4      4       V P!                  V
R4       VP'                  4        VP)                  4        R# )r   r   c                     \        V R  R7      # )c                     \        V 4      # r   )r  r  s   &r   rI  >TestWait.test_wait_integer.<locals>.<lambda>.<locals>.<lambda>Z  s    BqEr   r  )r  )r  s   &r   rI  ,TestWait.test_wait_integer.<locals>.<lambda>Z  s    F1/:r   r   r   Ng?)r	  r   r   r)  r  r   r	  r   r   r  r  r   r  r   r   rn   r{  r  r  r'  r   )rs   r   r  sorted_r%  r   r   r   r   r   r  s   &          r   test_wait_integerTestWait.test_wait_integerU  s   3:''*##%##4+@+@*-: 	
	ajj#.B/0 Azz1%x"}5 5(zzl+!|,5Q,/	t Azz1%r* 5(w

A'?@s#	t Azz1%r* 5(w::q/A'BCs#		r   c                @   ^ RI Hp \        P                  ! 4       w  r#\        P
                  ! 4       pV! V.RR7      p\        P
                  ! 4       V,
          pV P                  V. 4       V P                  V^4       VP                  4        VP                  4        R# )r   r   r   NrA   )	r	  r   r   r  r   r   rn   r{  r    )rs   r   r   r   r   r   s   &     r   test_neg_timeoutTestWait.test_neg_timeout  sp    3##%NNA3#NNq b!1				r   r\   Nr`  )ry   rz   r{   r|   r"  r  r	  r		  r	  r	  r	  r   r!  r	  r	  r%	  r(	  r   r   r   s   @r   r  r    s      -<  !4F$ z*# +#"   z*) +)V	 	r   r  c                      a  ] tR tRt o ]P
                  ! ]R4      R 4       t]P                  ! ]R4      R 4       t	Rt
V tR# )TestInvalidFamilyi  r  c                    V P                  \        4      ;_uu_ 4        \        P                  P	                  R 4       RRR4       R#   + '       g   i     R# ; i)z\\.\testNro   rE   r   r  r  r   s   &r   test_invalid_family%TestInvalidFamily.test_invalid_family  s6    z**&&//< +***    AA	z skipped on non-Windows platformsc                    V P                  \        4      ;_uu_ 4        \        P                  P	                  R 4       RRR4       R#   + '       g   i     R# ; i)z/var/test.pipeNr-	  r   s   &r   test_invalid_family_win32+TestInvalidFamily.test_invalid_family_win32  s7    z**&&//0@A +***r0	  r\   N)ry   rz   r{   r|   rF   r~   r  r.	  r#  r2	  r   r   r   s   @r   r+	  r+	    sH     __U01= 2=  BCB DBr   r+	  c                   F   a  ] tR tRt o ]R 4       t]R 4       tR tRtV t	R# )	TestFlagsi  c                V    VP                  \        \        P                  4      4       R # r   )r  r   r   flagsr   r'  s   &&r   run_in_grandchildTestFlags.run_in_grandchild  s    		%		"#r   c                &   ^ RI p\        P                  ! V4      pVP                  RR7      w  rEVP	                  V P
                  V3R7      p\        P                  ! \        R7      ;_uu_ 4        VP                  4        RRR4       VP                  4       pVP                  4        VP                  4        VP                  4        \        \        P                  4      V3p\!        VP#                  V4      4       R#   + '       g   i     L; i)r   NFr  r   )category)jsonr   r  r  r   r9	  r  r  DeprecationWarningr   r  r   r    r   r   r7	  printr  )	r   rS   r=	  mprh  rQ  r   grandchild_flagsr7	  s	   &&       r   run_in_childTestFlags.run_in_child  s    ((6wwew$JJc331$J?$$.@AAGGI B668					syy!#34djj  BAs   0D  D	c                    ^ RI pR\        P                  ! 4       : R2p\        P                  ! \
        P                  RRRRV.4      pVP                  VP                  R4      4      w  rEV P                  WE4       R# )	r   NzIfrom test._test_multiprocessing import TestFlags; TestFlags.run_in_child()r  z-Sz-Or  r  )
r=	  r   rP   r  check_outputr   r   r  r  rn   )rs   r=	  progr  child_flagsrA	  s   &     r   
test_flagsTestFlags.test_flags  st    &&5&F&F&H%K1N 	 &&^^T4tT:<(,

4;;w3G(H%7r   r\   N)
ry   rz   r{   r|   r"  r9	  rB	  rI	  r   r   r   s   @r   r5	  r5	    s5     $ $ ! !
8 
8r   r5	  c                   6   a  ] tR tRt o ]R 4       tR tRtV tR# )TestTimeoutsi  c                    \         P                  ! ^4       VP                  ^{4       VP                  4        \        P
                  P                  V4      pVP                  R4       VP                  4        R# )r   r  N)r   r-  r  r    r   r  r  )r   childr  r'  s   &&& r   _test_timeoutTestTimeouts._test_timeout  sK    

1

3))009		#

r   c                   \         P                  ! 4       p \         P                  ! R 4       \        P                  ! RR7      w  r#\        P
                  P                  RR7      p\        P                  ! V P                  W4P                  3R7      pVP                  4        VP                  4        V P                  VP                  4       ^{4       VP                  4        VP                  4       pV P                  VP                  4       R4       VP                  4        VP                  4        \        V4       \         P                  ! V4       R#   \         P                  ! T4       i ; i)r   Tr  AF_INETr  r   r  N)r  getdefaulttimeoutsetdefaulttimeoutr   r  r  r  r   rO	  r  r   r    rn   r  r  r'   )rs   old_timeoutparentrN	  r  r   r'  s   &      r   r  TestTimeouts.test_timeout  s    ..0	2$$S)+00=MF**3393EA''t/A/A.3YY-?AAGGIKKMV[[]C0LLN88:DTYY[#.JJLGGIO$$[1F$$[1s   D'E E.r\   N)	ry   rz   r{   r|   r"  rO	  r  r   r   r   s   @r   rL	  rL	    s!      2 2r   rL	  c                   &   a  ] tR tRt o R tRtV tR# )TestNoForkBombi  c                    \         P                  ! 4       p\        P                  P	                  \        P                  P                  \        4      R 4      pVR8w  dS   \        P                  P                  P                  W!4      w  r4pV P                  VR4       V P                  RV4       R# \        P                  P                  P                  W!4      w  r4pV P                  VP                  4       R4       V P                  VR4       R# )zmp_fork_bomb.pyrj   r   s   RuntimeErrors   123N)r   rP   rB   r   r   r4  r5  r  r   r   assert_python_failurern   rp   r  rb  )rs   r  r,   r  r  rt   s   &     r   test_noforkbombTestNoForkBomb.test_noforkbomb  s    --/ww||BGGOOH57HI<<<55KKDULBSS#&MM/3/<<55FFtPLBSSZZ\62S#&r   r\   N)ry   rz   r{   r|   r\	  r   r   r   s   @r   rY	  rY	    s     
' 
'r   rY	  c                   6   a  ] tR tRt o ]R 4       tR tRtV tR# )TestForkAwareThreadLocki  c                2   V^8  dX   \         P                  ! V P                  V^,
          V3R7      pVP                  4        VP	                  4        \        V4       M(VP                  \        \        P                  4      4       VP	                  4        R# )r   r   N)
r   r   rN	  r   r    r'   r  r   r   _afterfork_registry)r   r  r'  r   s   &&& r   rN	  TestForkAwareThreadLock.child  s`    q5''syy!T{KAGGIJJLOIIc$2234

r   c                r   \         P                  ! R 4      w  r\        P                  ! 4       p\	        \        P
                  4      p\         P                  ! V P                  ^V3R7      pVP                  4        VP                  4        VP                  4       p\        V4       V P                  Wd4       R# )Fr   N)r   r  r   ForkAwareThreadLockr   ra	  r   rN	  r   r    r  r'   assertLessEqual)rs   rh  rQ  r  old_sizer   new_sizes   &      r   r  !TestForkAwareThreadLock.test_lock  s~    ##E*$$&t//0##4::QFC				668QX0r   r\   N)	ry   rz   r{   r|   r"  rN	  r  r   r   r   s   @r   r_	  r_	    s#     
  	1 	1r   r_	  c                   B   a  ] tR tRt o R tR t]R 4       tR tRt	V t
R# )TestCloseFdsi  c                L   \         '       d$   \        P                  ! 4       P                  4       # \        P                  ! 4       P                  4       p. pV^28  d*   VP                  V4       \        P
                  ! V4      pK0  V F  p\        P                  ! V4       K  	  V# )2   )r  r  detachr  rB   dupr    )rs   rV  to_closer1  s   &   r   get_high_socket_fdTestCloseFds.get_high_socket_fd  ss    5 ==?))++ '')BHr'#VVBZ Ir   c                    \         '       dF   \        P                  ! \        P                  \        P                  VR 7      P	                  4        R# \
        P                  ! V4       R# ))ra  N)r  r  rR	  SOCK_STREAMr    rB   )rs   rV  s   &&r   r    TestCloseFds.close*  s5    5MM&..&*<*<RHNNPHHRLr   c                    \         P                  ! V\         P                  \         P                  4      pVP	                  4        VP                  R 4       R #   \         d   pTP                  T4        R p?R # R p?ii ; ir   )r  fromfdrR	  rs	  r    r  rk   )r   r'  rV  r   r<  s   &&&  r   _test_closefdsTestCloseFds._test_closefds0  sX    	b&..&2D2DEA GGIIIdO	  	IIaLL	s   4A B $A;;B c                8   \         '       g   \        P                  ! R 4      h\        P                  ! 4       w  rV P                  4       p \        P                  ! V P                  W#3R7      pVP                  4        VP                  4        VP                  4       p\        V4       V P                  V4       VP                  4        VP                  4        \        P                  ! 4       R8X  d   V P                  VR4       R# RpV P                  V\        4       T P!                  VP"                  \"        P$                  8H  ;'       g    VP&                  V8H  V4       R#   T P                  T4       TP                  4        TP                  4        i ; i)zrequires fd picklingr   rj   Ni6'  )r  rF   rG   r   r  rp	  r   rw	  r   r    r  r'   rP   r:  r   r  r   r5  r}  winerror)rs   ro  rp  rV  r   r<  WSAENOTSOCKs   &      r   test_closefdTestCloseFds.test_closefd:  s"   }##$:;;(--/$$&
	''t/B/B.4\;AGGILLNAOJJrNLLNLLN++-7MM!T"K!!!W-OOAGGu{{2 6 6JJ+5q: JJrNLLNLLNs   AE& &3Fr\   N)ry   rz   r{   r|   rp	  r    r"  rw	  r|	  r   r   r   s   @r   rj	  rj	    s-     $  : :r   rj	  c                      a  ] tR tRt o ]! ]P                  ]P                  4      t]	R 4       t
]P                  ! ]! ]R4      R4      R 4       t]	R 4       t]P                  ! ]! ]R4      R4      R 4       tRtV tR	# )
TestIgnoreEINTRiX  c                    R  p\         P                   ! \         P                  V4       VP                  R4       VP                  4       pVP                  V4       VP	                  RV P
                  ,          4       R# )c                     R # r   r\   r   frames   &&r   ri  -TestIgnoreEINTR._test_ignore.<locals>.handler_  r  r   ready   xN)rZ  rs  r  r  r[  CONN_MAX_SIZE)r   r'  ri  r1  s   &&  r   _test_ignoreTestIgnoreEINTR._test_ignore]  sR    	fnng.		'IIK		!s0001r   rs  rv  c                   \         P                  ! 4       w  r \         P                  ! V P                  V3R 7      pRVn        VP                  4        VP                  4        V P                  VP                  4       R4       \        P                  ! R4       \        P                  ! VP                  \        P                  4       \        P                  ! R4       VP!                  R4       V P                  VP                  4       R4       \        P                  ! R4       \        P                  ! VP                  \        P                  4       V P                  VP#                  4       RV P$                  ,          4       \        P                  ! R4       VP'                  4        VP                  4        R#   TP                  4        i ; i)r   Tr	  r     r	  N)r   r  r   r	  r   r   r    rn   r  r   r-  rB   r  r	  rZ  rs  r  rY  r	  r   r  s   &   r   test_ignoreTestIgnoreEINTR.test_ignoreg  s   *//1	''t/@/@.8]<AAHGGITYY['2JJsOGGAEE6>>*JJsOIIdOTYY[$/JJsOGGAEE6>>*T__.t7I7I0IJJJsOFFHJJLDJJLs   FF= =Gc                T   R  p\         P                   ! \         P                  V4       \        P                  P	                  4       ;_uu_ 4       pVP                  VP                  4       VP                  4       pVP                  R4       RRR4       R#   + '       g   i     R# ; i)c                     R # r   r\   r	  s   &&r   ri  6TestIgnoreEINTR._test_ignore_listener.<locals>.handler  r  r   welcomeN)rZ  rs  r   r  r  r  r  r  )r   r'  ri  r  r   s   &&   r   _test_ignore_listener%TestIgnoreEINTR._test_ignore_listener~  sf    	fnng.''0022aIIaii 
AFF9 3222s   =BB'	c                   \         P                  ! 4       w  r \         P                  ! V P                  V3R 7      pRVn        VP                  4        VP                  4        VP                  4       p\        P                  ! R4       \        P                  ! VP                  \        P                  4       \        P                  ! R4       \         P                  P!                  V4      pV P#                  VP                  4       R4       VP%                  4        VP                  4        R#   TP                  4        i ; i)r   Tr   r	  N)r   r  r   r	  r   r   r    r  r   r-  rB   r  r	  rZ  rs  r  r  rn   r   )rs   r'  r)  r   r  r  s   &     r   test_ignore_listener$TestIgnoreEINTR.test_ignore_listener  s    *//1	''t/I/I.8]<AAHGGIiikGJJsOGGAEE6>>*JJsO$//66w?FV[[]I6FFHJJLDJJLs   DD/ /Er\   N)ry   rz   r{   r|   maxr   PIPE_MAX_SIZESOCK_MAX_SIZEr	  r"  r	  rF   r#  rk  rZ  r	  r	  r	  r   r   r   s   @r   r	  r	  X  s      --w/D/DEM2 2 35GH I,   35GH Ir   r	  c                      a  ] tR tRt o ]R 4       tR tR tR tR t	R t
R t]P                  ! ]P                  R	8H  R
4      ]! R4      R 4       4       t]R 4       t]R 4       tR tRtV tR# )TestStartMethodi  c                N    VP                  \        P                  ! 4       4       R # r   )r  r   rP   r8	  s   &&r   _check_contextTestStartMethod._check_context  s    		/2245r   c                H   VP                  R R7      w  r#VP                  V P                  V3R7      pVP                  4        VP	                  4        VP                  4       pVP	                  4        VP                  4        V P                  WQP                  4       4       R# )Fr  r   N)	r  r   r	  r   r    r  r   rn   rP   )rs   rv   rh  rQ  r   child_methods   &&    r   check_contextTestStartMethod.check_context  st    xxux%KKt22!K>				vvx			';';'=>r   c                   R F  p \         P                  ! V4      pT P                  TP	                  4       T4       T P                  TP                  4       T4       T P                  \        TP                  R4       T P                  \        TP                  R4       T P                  T4       K  	  R#   \         d     K  i ; i)rj   rN   Nrj   rN   r  )	r   r  rE   rn   rP   r:  ro   rm   r	  )rs   methodrv   s   &  r   ri  TestStartMethod.test_context  s    5F%11&9 S113V<MM#//+S1j#*>*>Hj#*>*>Es# 6  s   B66CCc                    \         P                  ! R 4      pT P                  \        R4      ;_uu_ 4        TP                  . RO4       RRR4       R#   \         d    \        P                  ! R4      hi ; i  + '       g   i     R# ; i)r  zforkserver should be availablez&module_names must be a list of stringsNr]  )r   r  rE   rF   rG   r  r  set_forkserver_preload)rs   rv   s   & r   test_context_check_module_types/TestStartMethod.test_context_check_module_types  st    	F!--l;C ##I/WXX&&y1 YX  	F##$DEE	FXXXs   A A9"A69B
	c                    \         P                  ! \        4       ^ p\         P                  ! 4       p R F  p \         P                  ! VRR7       T P                  \         P                  ! 4       T4       \         P                  ! 4       pT P                  TP                  4       T4       T P                  \        T4      P                  P                  4       T4       T P                  TP                  P                  P                  4       T4       T P                  \         4       T^,          pK  	  \         P                  ! VRR7       V P                  V^4       R#   \
         d     EK:  i ; i  \         P                  ! TRR7       i ; i)r   Trh   Nr	  )r   r	  PRELOADrP   rm   rE   rn   r  assertStartsWithr;  ry   lowerr   r	  r  )rs   r  
old_methodr	  rv   s   &    r   test_set_getTestStartMethod.test_set_get  s0   ..w7$557
	E9#44V4H   !A!A!CVL%113  !5!5!7@%%d3i&8&8&>&>&@&I%%ckk&:&:&@&@&BFK""?3
 : ,,ZtDq) "  ,,ZtDs/   E3 E C#E3  E0+E3 /E00E3 3Fc                P   \         P                  ! 4       pV P                  R V4       \        P                  R8X  d   V P                  VR .4       R# \        P                  R8X  d@   V P                  V^ ,          R 4       V P                  RV4       V P                  RV4       R# V P                  RV4       \        V4      RR 0,
          ;p'       d   V P                  R0V4       V P                  V^ ,          RR 0RR7       V^ ,          R 8X  d   V P                  RV4       R# R# )rN   r1   r  rj   r  z3.14+ default must not be forkr\  N)r   get_all_start_methodsrp   r   r   rn   r   r8  )rs   methodsother_methodss   &  r   test_get_all_start_methods*TestStartMethod.test_get_all_start_methods  s    !779gw'<<7"Wwi0\\X%WQZ1MM&'*MM,0 MM&'* #G/@ @@}@  ,?MM'!*|W&=>  @qzW$   w7 %r   c                    \         P                  ! 4       R 8w  d   V P                  R4       \        P                  P                  \        P                  P                  \        4      R4      p\        P                  P                  P                  V4      w  r#pVP                  4       pVP                  4       pVP                  4       R8w  g   VR8w  d*   \        V4       \        V4       V P                  R4       R# R# )r  z*test only relevant for 'forkserver' methodzmp_preload.pyokrU  z(failed spawning forkserver or grandchildN)r   rP   r   rB   r   r   r4  r5  r  r   r   r  r  rb  r?	  rl   )rs   r,   r  r  rt   s   &    r   test_preload_resources&TestStartMethod.test_preload_resources  s    ++-=MMFGww||BGGOOH5G||11BB4Hjjljjl::<43"9#J#JII@A $-r   r1   z*Only Spawn on windows so no risk of mixingavoids redundant testing.c                   R F  p\         P                  ! R4      P                  4       p\         P                  ! V4      pVP                  \        V3R7      pRpV P                  \        V4      ;_uu_ 4        VP                  4        RRR4       K  	  R F  p\         P                  ! 4        Fu  p\         P                  ! V4      P                  4       p\         P                  ! V4      pVP                  \        V3R7      pVP                  4        VP                  4        Kw  	  K  	  R#   + '       g   i     EK=  ; i)rN   rj   r   zA SemLock created in a forkN)rN   r  )
r   r  r   r   r$   r  rh  r   r	  r   )rs   process_methodr#   process_ctxr   r  queue_methods   &      r   test_mixed_startmethod&TestStartMethod.test_mixed_startmethod  s    
 6N#//7==?E)55nEK##;eX#FA3G''g>>	 ?> 6 4L"1"G"G"I'33LAGGI-99.I''{%'J	 #J 4	 ?>>s   8D..E c                (    VP                  ^4       R# r   r   )r   r#   s   &&r   _put_one_in_queue!TestStartMethod._put_one_in_queue  s    		!r   c                    VP                  ^4       \        P                  ! V P                  V3R7      pVP	                  4        VP                  4        R# r  )r   r   r   r	  r   r   )r   r#   r&   s   && r   _put_two_and_nest_once&TestStartMethod._put_two_and_nest_once  s9    		!!))1F1FeXVr   c                t   \         P                  ! 4       p\         P                  ! V P                  V3R 7      pVP	                  4        VP                  4        . pVP                  4       '       g"   VP                  VP                  4       4       K7  V P                  \        V4      \        ^^.4      4       R# r  )r   r   r   r	  r   r   ri  r  r   assertSetEqualr   )rs   r#   r&   r  s   &   r   test_nested_startmethod'TestStartMethod.test_nested_startmethod  s      %%'!))1L1LTYS[\++--NN599;' 	CL#q!f+6r   r\   N)ry   rz   r{   r|   r"  r	  r	  ri  r	  r	  r	  r	  rF   r~   r   r   r]   r	  r	  r	  r	  r   r   r   s   @r   r	  r	    s     6 6?
$2**80
B __S\\W,AC !<= >C&    7 7r   r	  r  c                     a  ] tR tRt o R tR tR tR t]P                  ! ]
P                  P                  R4      R4      R 4       t]R	 4       tR
 tR tR tR t]P(                  ! ]! ]R4      R4      R 4       tRtV tR# )TestResourceTrackeri*  c                R   R p\         P                   EF  pV P                  VR7      ;_uu_ 4        VR9   d    RRR4       K1  \        P                  ! 4       w  r4\
        P                  ! \        P                  RRVP                  WBR7      .V.\
        P                  R7      p\        P                  ! V4       \        VRRR	7      ;_uu_ 4       pVP                  4       P                  4       P                  R
4      pVP                  4       P                  4       P                  R
4      pRRR4       \!        XV4       VP#                  4        VP%                  4        RV R2p	\&        P(                  ! \&        P*                  V	4       F  p
 \!        XV4       K  	  VP6                  P9                  4       P                  R4      pVP6                  P                  4        RP                  V4      pV P;                  W4       V P;                  VRV,          4       RRR4       EK  	  R#   + '       g   i     EL	; i  \,         dG   pT P/                  TP0                  \0        P2                  \0        P4                  34        Rp? K  Rp?ii ; i  + '       g   i     EK  ; i)a  if 1:
            import time, os
            import multiprocessing as mp
            from multiprocessing import resource_tracker
            from multiprocessing.shared_memory import SharedMemory

            mp.set_start_method("spawn")


            def create_and_register_resource(rtype):
                if rtype == "semaphore":
                    lock = mp.Lock()
                    return lock, lock._semlock.name
                elif rtype == "shared_memory":
                    sm = SharedMemory(create=True, size=10)
                    return sm, sm._name
                else:
                    raise ValueError(
                        "Resource type {{}} not understood".format(rtype))


            resource1, rname1 = create_and_register_resource("{rtype}")
            resource2, rname2 = create_and_register_resource("{rtype}")

            os.write({w}, rname1.encode("ascii") + b"\n")
            os.write({w}, rname2.encode("ascii") + b"\n")

            time.sleep(10)
        )r-   Nr  r  )rQ  r-   )pass_fdsr  r  T)rR  r  zA z< resource was leaked after a process was abruptly terminatedrB  z8resource_tracker: There appear to be 2 leaked {} objectszresource_tracker: %r: \[Errno)noopdummy)r)   r+   r   rB   piper  r  r   r   r   r  r    rI  r  rb  r  r.   r'  r   r   r:  r0  r  rp   r5  ENOENTEINVALr  rJ  r  )rs   r  r-   rh  rQ  r   rL  name1name2r  r  r<  rt   r  s   &             r   test_resource_tracker)TestResourceTracker.test_resource_tracker.  s	   : &44EE**-- 	 +*
 wwy$$cnn%)4a1M&O/0c,6OO= !T400AJJL//188AEJJL//188AE 1 !.w '1 2 //0E0E29;A(6; hhmmo,,W5 &&,f!'#    /  &F&NOI +* 5 100 #  aggell/KL	1 +**sW   	JBJAH,,A"JI BJ,H=7	J J:JJJJJ&c                   ^ RI Hp VP                  pVeM   \        P                  ! V\
        P                  4       \        P                  ! V\
        P                  ) R7       \        P                  ! 4       ;_uu_ 4        \        P                  ! R4       VP                  4        RRR4       VP                  p\        P                  ! WA4       \        P                  ! R4       \        P                   ! R4      p\        P                  ! RR7      ;_uu_ 4       p\        P                  ! R	4       VP#                  4       pVP%                  4        VP'                  4        \(        P*                  ! V4      p?\,        P.                  ! 4        V P1                  V! 4       4       V'       dk   V P3                  \5        V4      ^4       V^ ,          p	V P7                  V	P8                  \:        4       V P=                  R
\?        V	P@                  4      4       MV P3                  \5        V4      ^ 4       RRR4       R#   + '       g   i     EL; i  + '       g   i     R# ; i)r   _resource_trackerN)r   r  r  rN   T)rz  alwayszresource_tracker: process died)! multiprocessing.resource_trackerr	  r  rB   r  rZ  r  r   wait_processr  r  r  r  r   r-  r   r  r)  r  r  r  r  r  r  r  rn   r   assertIsSubclassr<	  UserWarningrp   rq   r  )
rs   r   
should_dier	  r	  rv   all_warnr%  r  the_warns
   &&&       r   check_resource_tracker_death0TestResourceTracker.check_resource_tracker_deathv  s    	G$$?GGC(  ?$$&&!!(+,,. '  $$


3))'2$$D11X!!(+--/CKKMKKMS!B JJLbd#  X2#A;%%h&7&7E>!("2"235   X2% 21 '&& 211s    'H<DI<I	I!	c                F    V P                  \        P                  R 4       R# r  )r	  rZ  r[  r   s   &r   test_resource_tracker_sigint0TestResourceTracker.test_resource_tracker_sigint  s    ))&--?r   c                F    V P                  \        P                  R 4       R# r  )r	  rZ  r|  r   s   &r   test_resource_tracker_sigterm1TestResourceTracker.test_resource_tracker_sigterm  s    ))&..%@r   netbsdzKgh-125620: Skip on NetBSD due to long wait for SIGKILL process termination.c                F    V P                  \        P                  R 4       R# r  )r	  rZ  r  r   s   &r   test_resource_tracker_sigkill1TestResourceTracker.test_resource_tracker_sigkill  s     	))&..$?r   c                    ^ RI Hp VP                  4        VP                  RV39   pW2P	                  4       ,          pV P                  V4       R# )r   r	  N)r	  r	  r  r  _check_aliver  )r'  r	  r	  reuseds   &&  r   _is_resource_tracker_reused/TestResourceTracker._is_resource_tracker_reused  sD    F((* #''D#;60022		&r   c                   ^ RI Hp VP                  4        VP                  p\        P
                  ! RR7      w  r4\        P                  ! V P                  WB3R7      pVP                  4        VP                  4       pVP                  4        VP                  4        VP                  4        V P                  V4       R# )r   r	  Fr  r   N)r	  r	  r  r  r   r  r   r	  r   r  r   r    r   )rs   r	  r	  rh  rQ  r   is_resource_tracker_reuseds   &      r   test_resource_tracker_reused0TestResourceTracker.test_resource_tracker_reused  s    F((*$$##51##4+K+K*+3		%&VVX" 	
				23r   c                    R pRR\        V4      ,
          ,          pV P                  \        4      ;_uu_ 4        \        P                  ! W!4       RRR4       R#   + '       g   i     R# ; i)r   r   rc  N)r   ro   rE   r)   register)rs   r-   too_long_name_resources   &  r   test_too_long_name_resource/TestResourceTracker.test_too_long_name_resource  sL      !$c%j(8!9z**%%&<D +***s   AA+	c                   ^ RI Hp V! 4       pVP                  4        V P                  VP	                  4       4       V P                  VP                  4       VP                  RR4       V'       d   VP                  RR4       ^ pM^pV P                  VP	                  4       4       V P                  VP                  4       VP                  4        V P                  VP                  V4       R# )r   ResourceTrackersomenamer	  N)r	  r
  r  r   r	  r  	_exitcoder	  r  _stoprn   )rs   cleanupr
  trackerexpected_exit_codes   &&   r   %_test_resource_tracker_leak_resources9TestResourceTracker._test_resource_tracker_leak_resources  s     	E!# ,,./'++,W-z73!"!",,./'++,**,>?r   c                    R F8  pV P                  VR7      ;_uu_ 4        V P                  VR7       RRR4       K:  	  R#   + '       g   i     KO  ; i)zt
Test the exit code of the resource tracker.

If no leaked resources were found, exit code should be 0, otherwise 1
)r
  N)TF)r   r	
  )rs   r
  s   & r   test_resource_tracker_exit_code3TestResourceTracker.test_resource_tracker_exit_code  sG     %Gg..::# ;  /. %...s   AApthread_sigmaskz pthread_sigmask is not availablec                   ^ RI Hp \        P                  ! \        P                  \        4       4      p\        P                  \        P                  \        P                  0p V F  p\        P                  ! \        P                  V04       V P                  \        P                  ! \        P                  \        4       4      V04       V! 4       pVP                  4        V P                  \        P                  ! \        P                  \        4       4      V04       VP                  4        K  	  \        P                  ! \        P                  V4       R#   \        P                  ! \        P                  T4       i ; i)r   r
  N)r	  r
  rZ  r
  	SIG_BLOCKr   r|  r[  rs  SIG_SETMASKrn   r  r
  )rs   r
  orig_sigmasksignalssigr
  s   &     r   %test_resource_tracker_blocked_signals9TestResourceTracker.test_resource_tracker_blocked_signals  s    
 	E--f.>.>F>>6==&..A
	E&&v'9'9C5A  !7!78H8H#%!PSVRWX)+&&(  !7!78H8H#%!PSVRWX  ""6#5#5|DF""6#5#5|Ds   $CE 'Fr\   N)ry   rz   r{   r|   r	  r	  r	  r	  rF   r~   r   r   r  r	  r%  r	  r	  r	  r	
  r
  r#  rk  rZ  r
  r   r   r   s   @r   r	  r	  *  s     FPP#3J@A __S\\,,X6bd@d@  4$E@*
 ):;=_`E aEr   r	  c                   z   a  ] tR tRt o ]R 4       tR tR tR t]	P                  P                  R 4       tRtV tR# )	TestSimpleQueuei  c                    VP                  4         VP                  VP                  4       4       VP                  VP                  4       4       VP                  4        R #   TP                  4        i ; ir   )r   r   ri  r   r  s   &&&&r   _test_emptyTestSimpleQueue._test_empty  sQ    	&IIekkm$IIekkm$##%##%s   >A" "A4c                    \         P                  ! 4       pVP                  4        V P                  \        R 4      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)r  N)r   SimpleQueuer    r  r  ri  r  s   & r   test_empty_exceptions%TestSimpleQueue.test_empty_exceptions  sF     '')		##G[99GGI :999s   AA0	c                   \         P                  ! 4       p\         P                  ! 4       p\         P                  ! 4       p\         P                  ! V P                  WV3R 7      pRVn        VP                  4        V P                  VP                  4       4       VP                  4        VP                  4        V P                  VP                  4       4       V P                  VP                  4       R4       V P                  VP                  4       R4       V P                  VP                  4       4       VP                  4        R# )r   TFN)r   r
  r7  r   r
  r   r   r   ri  r   r   r   rn   r   r   )rs   r#   ru  rv  r  s   &    r   
test_emptyTestSimpleQueue.test_empty  s    ++-)//1-335&&##*=>
 

&  "'d+e,&		r   c                p    \         P                  ! 4       pVP                  4        VP                  4        R # r   )r   r
  r    rs   r#   s   & r   r  TestSimpleQueue.test_close0  s"    ++-r   c                    \         P                  ! 4       pVP                  4        V P                  VP                  P
                  4       V P                  VP                  P
                  4       R # r   )r   r
  r    r   _readerr  _writerr$
  s   & r   test_closedTestSimpleQueue.test_closed7  sE    ++-,,-,,-r   r\   N)ry   rz   r{   r|   r"  r
  r
  r!
  r  r  r   cpython_onlyr)
  r   r   r   s   @r   r
  r
    sD     & &0 
\\. .r   r
  c                   &   a  ] tR tRt o R tRtV tR# )TestPoolNotLeakOnFailurei?  c           	       aa ^o. o ! VV3R lR4      pV P                  \        R4      ;_uu_ 4        \        P                  P	                  ^\
        P                  P                  VR7      R7      pVP                  4        VP                  4        RRR4       S F#  pV P                  VP                  4       V4       K%  	  R#   + '       g   i     L;; i)r^  c                   L   <a  ] tR tRt o V3R ltV3R ltR tR tR tRt	V t
R# )	RTestPoolNotLeakOnFailure.test_release_unused_processes.<locals>.FailingForkProcessiG  c                T   < R V n         RV n        RV n        SP                  V 4       R# )zFake ProcessN)r,   r   rb  r  )rs   rR   forked_processess   &,r   r   [TestPoolNotLeakOnFailure.test_release_unused_processes.<locals>.FailingForkProcess.__init__H  s&    *	 $!
 ''-r   c                L   < S^ 8:  d   \        R4      hS^,          oRV n        R# )r   Manually induced OSErrorr  N)r  rb  )rs   will_fail_ins   &r   r   XTestPoolNotLeakOnFailure.test_release_unused_processes.<locals>.FailingForkProcess.startN  s(    1$!"<==!&
r   c                    R V n         R# )stoppingNra  r   s   &r   r'  \TestPoolNotLeakOnFailure.test_release_unused_processes.<locals>.FailingForkProcess.terminateU  s	    '
r   c                :    V P                   R 8X  d
   RV n         R# R# )r9
  stoppedNra  r   s   &r   r   WTestPoolNotLeakOnFailure.test_release_unused_processes.<locals>.FailingForkProcess.joinX  s    ::+!*DJ ,r   c                N    V P                   R 8H  ;'       g    V P                   R8H  # )r  r9
  ra  r   s   &r   r   [TestPoolNotLeakOnFailure.test_release_unused_processes.<locals>.FailingForkProcess.is_alive\  s"    zzY.JJ$**
2JJr   )r   r,   rb  N)ry   rz   r{   r|   r   r   r'  r   r   r   r   )r   r2
  r6
  s   @r   FailingForkProcessr0
  G  s%     .'(+K Kr   r@
  r5
  )r   )contextN)r  r  r   r  r  rF   r  	MagicMockr    r   r   r   )rs   r@
  r   r&   r2
  r6
  s   &   @@r   test_release_unused_processes6TestPoolNotLeakOnFailure.test_release_unused_processesA  s     	K 	K0 ##G-GHH$$))!X]]5L5L* 6M 6,) -AGGIFFH	 I
 (GW--/9 ( IHs   A CC	r\   N)ry   rz   r{   r|   rC
  r   r   r   s   @r   r-
  r-
  ?  s     $: $:r   r-
  c                     a  ] tR tRt o Rt]P                  P                  tR t	R t
]R 4       t]tR tR t]R 4       tR	 t]R
 4       tR,R lt]R 4       tR-R lt]R 4       tR.R ltR t]R 4       tR t]R 4       tR t]R 4       tR t]R 4       tR/R lt R t!]R 4       t"R t#]R 4       t$R t%]R 4       t&R t']R  4       t(R! t)]R" 4       t*R# t+]R$ 4       t,]R% 4       t-]R& 4       t.R' t/R( t0R) t1R*t2V t3R+# )0TestSyncManagerTypesih  a9  Test all the types which can be shared between a parent and a
child process by using a manager which acts as an intermediary
between them.

In the following unit-tests the base type is created in the parent
process, the @classmethod represents the worker process and the
shared object is readable and editable between the two.

# The child.
@classmethod
def _test_list(cls, obj):
    assert obj[0] == 5
    assert obj.append(6)

# The parent.
def test_list(self):
    o = self.manager.list()
    o.append(5)
    self.run_worker(self._test_list, o)
    assert o[1] == 6
c                r    V P                  4       V n        V P                  P                  4        R V n        R # r   )manager_classr   r   r  r   s   &r   r  TestSyncManagerTypes.setUp  s)    ))+	r   c                   V P                   eU   V P                   P                  4       '       d5   V P                   P                  4        V P                   P                  4        V P                  P                  4        R V n        R V n         R # r   )r  r   r'  r   r   r   r   s   &r   r  TestSyncManagerTypes.tearDown  sZ    99 TYY%7%7%9%9II!IINN	r   c                0    \         P                  ! 4        R # r   )r   reap_childrenrQ  s   &r   r  TestSyncManagerTypes.setUpClass  s    r   c                   \        V P                  4       \        p\        P                  ! 4       p\
        P                  ! VR R7       F)  p\        \        P                  ! 4       4      ^8:  g   K(   R# 	  \        P                  ! 4       V,
          pR\
        n
        \
        P                  ! R\        P                  ! 4        RVR R24       R# )FerrorT"multiprocessing.Manager still has  active children after .1frd  N)r'   r  WAIT_ACTIVE_CHILDREN_TIMEOUTr   r   r   r:  r   r   r9  environment_alteredprint_warning)rs   r5   
start_timer  rr  s   &    r   wait_proc_exit#TestSyncManagerTypes.wait_proc_exit  s     	TYY.^^%
''u=A?2245: > !J.B*.G'!!$F%4%D%D%F$G H;;=c((#L Mr   c                   \         P                  ! W3R 7      V n        RV P                  n        V P                  P	                  4        V P                  4        V P                  V P                  P                  ^ 4       R# r  )r   r   r  r   r   rY
  rn   r   )rs   workerr  s   &&&r   
run_workerTestSyncManagerTypes.run_worker  sV    #++6H					++Q/r   c                h    VP                  4        VP                  4        VP                  R 4       R# r  N)r   r  r   r  s   &&r   r   TestSyncManagerTypes._test_event  s!     	
		r   c                    V P                   P                  4       pVP                  4        V P                  V P                  V4       VP                  R 4       R# r`
  )r   r7  r   r]
  r  r   rs   r  s   & r   r  TestSyncManagerTypes.test_event  s<    LL 	((!,	ur   c                F    VP                  4        VP                  4        R # r   )r  r  ra
  s   &&r   
_test_lockTestSyncManagerTypes._test_lock  s    

r   c                    \        V P                  V4      ! 4       pV P                  V P                  V4       VP	                  4        V P                  \        VP                  4       R # r   )r  r   r]
  rg
  r  ro   rh  rs   lnamer  s   && r   r  TestSyncManagerTypes.test_lock  sD    DLL%(*+			,		2r   c                f    VP                  4        VP                  4        VP                  4        R # r   )r  r  r  ra
  s   &&r   _test_rlock TestSyncManagerTypes._test_rlock  s    

r   c                t    \        V P                  V4      ! 4       pV P                  V P                  V4       R # r   )r  r   r]
  rn
  rj
  s   && r   r  TestSyncManagerTypes.test_rlock  s)    DLL%(*((!,r   c                &    VP                  4        R # r   )r  ra
  s   &&r   r&  $TestSyncManagerTypes._test_semaphore  s    r   c                    \        V P                  V4      ! 4       pV P                  V P                  V4       VP	                  4        R # r   )r  r   r]
  r&  r  )rs   snamer  s   && r   r*  #TestSyncManagerTypes.test_semaphore  s2    DLL%(*,,a0			r   c                *    V P                  R R7       R# )r-  )ru
  N)r*  r   s   &r   r.  +TestSyncManagerTypes.test_bounded_semaphore  s    "45r   c                F    VP                  4        VP                  4        R # r   )r  r  ra
  s   &&r   _test_condition$TestSyncManagerTypes._test_condition  s    r   c                r    V P                   P                  4       pV P                  V P                  V4       R # r   )r   rN  r]
  rz
  rd
  s   & r   test_condition#TestSyncManagerTypes.test_condition  s(    LL""$,,a0r   c                &    VP                  4        R # r   )r	  ra
  s   &&r   _test_barrier"TestSyncManagerTypes._test_barrier  s     			r   c                t    V P                   P                  ^4      pV P                  V P                  V4       R# r   )r   r  r]
  r
  rd
  s   & r   r  !TestSyncManagerTypes.test_barrier  s*    LL  #**A.r   c                V    V;_uu_ 4         R R R 4       R #   + '       g   i     R # ; ir   r\   ra
  s   &&r   
_test_poolTestSyncManagerTypes._test_pool  s     S SSSs   (	c                v    V P                   P                  ^R7      pV P                  V P                  V4       R# )rc   rg  N)r   r  r]
  r
  rd
  s   & r   	test_poolTestSyncManagerTypes.test_pool  s+    LL*+r   c                    R # r   r\   ra
  s   &&r   _test_queue TestSyncManagerTypes._test_queue  s    r   c                    \        V P                  V4      ! ^4      pVP                  ^4       VP                  ^4       V P                  V P                  V4       R# r  )r  r   r   r]
  r
  )rs   qnamer  s   && r   
test_queueTestSyncManagerTypes.test_queue  sA    DLL%(+	a	a((!,r   c                (    V P                  R 4       R# )r  N)r
  r   s   &r   test_joinable_queue(TestSyncManagerTypes.test_joinable_queue
  s    (r   c                   \         P                  ! 4       pVP                  V^ ,          ^4       VP                  VP                  ^4      ^4       VP                  VP	                  ^4      ^ 4       V^.,          pVP                  V\        P                  P                  4       VP                  \        V4      ^^.4       V^,          pVP                  V\        P                  P                  4       VP                  \        V4      . RO4       V^,          pVP                  V\        4       VP                  \        V4      . RO4       ^V,          pVP                  V\        4       VP                  \        V4      . RO4       VP                  4       pVP                  V\        4       VP                  \        V4      . RO4       VP                  W4,           4       VP                  4        VP                  4        V F  pK  	  VP                  \        V4      ^4       VP                  VP!                  ^ 4      ^4       VP#                  4        VP                  \        V4      ^ 4       R# )r   N)r   rh  r   rh  )r   rh  r   rh  r   rh  r   rh  )rF   TestCasern   r  r  r   r   rQ  	ListProxyassertListEqualr   r   r  r(  r  r   r  r  )r   r  case
double_obj
copied_objr1  s   &&    r   
_test_listTestSyncManagerTypes._test_list  s     "Q#1q)1q)s
c?#;#;#E#EFT#YA/qc?#;#;#E#EFT#Y51W
j$/T*-/GHW
j$/T*-/GHXXZ
j$/T*-|<

:*+
A S2&Q'		S1%r   c                    V P                   P                  4       pVP                  ^4       V P                  V P                  V4       V P                  V4       V P                  \        V4      ^ 4       R# r   )r   r   r  r]
  r
  r  rn   r   rd
  s   & r   r  TestSyncManagerTypes.test_list,  sS    LL	+QQ#r   c           	     6   \         P                  ! 4       pVP                  \        V4      ^4       VP                  VR,          ^4       VP                  VP	                  R4      ^4       VP                  \        VP                  4       4      R.4       VP                  \        VP                  4       4      R.4       VP                  \        VP                  4       4      ^.4       VP                  VP                  4       R^/4       VR^/,          pVP                  V\        P                  P                  4       VP                  \!        V4      R^R^/4       \#        V4      pVP                  V\%        \'        . 4      4      4       VP                  \        V4      RR.4       R^R^/V,          pVP                  V\         4       VP                  \!        V4      R^R^R^/4       VR^R^/,          pVP                  V\         4       VP                  \!        V4      R^R^R^/4       VP)                  R.^4      pVP                  V\         4       VP                  VR^/4       VP+                  4       pVP                  V\,        4       VP/                  VR4       VP1                  R^ 4       VP3                  R^/4       VP                  VP5                  R4      ^4       VP7                  4        VP                  \        V4      ^ 4       R# )r   r  r  r  N)r  r   )r  rt  )rF   r
  rn   r   r   r
  r   r  r  r;  assertDictEqualr   r   r   rQ  	DictProxyr  reversedr;  r-  fromkeysr  r   assertTupleEqualr  r  r  r  )r   r  r
  r1  s   &&  r   
_test_dictTestSyncManagerTypes._test_dict3  s}     "S1%UQ'+T#))+.=T#((*-w7T#**,/!5SXXZ%4qzc?#;#;#E#EFT#Y5!(<=SMad2h0T!Wuen5Aua 3&a&T!Wua5!&DE5!UA&&a&T!Wua5!&DELL%!$a&Q
+KKMa'a,ua 

E1:+		S1%r   c                    V P                   P                  4       p^VR&   V P                  V P                  V4       V P	                  V4       V P                  \        V4      ^ 4       R# )r   r  N)r   r  r]
  r
  r  rn   r   rd
  s   & r   r  TestSyncManagerTypes.test_dictU  sQ    LL%+QQ#r   c                    \         P                  ! 4       pVP                  VP                  ^4       VP                  VP	                  4       ^4       VP                  ^4       R# r   )rF   r
  rn   r   r   r   r   r  r
  s   && r   _test_value TestSyncManagerTypes._test_value\  sE      "A&A&
r   c                    V P                   P                  R ^4      pV P                  V P                  V4       V P	                  VP
                  ^4       V P	                  VP                  4       ^4       R# r  )r   r   r]
  r
  rn   r   r   rd
  s   & r   rC  TestSyncManagerTypes.test_valuec  sV    LLsA&((!,!$!$r   c                   \         P                  ! 4       pVP                  V^ ,          ^ 4       VP                  V^,          ^4       VP                  \        V4      ^4       VP	                  \        V4      ^ ^.4       R# r   )rF   r
  rn   r   r
  r   r
  s   && r   _test_array TestSyncManagerTypes._test_arrayi  sd      "Q#Q#S1%T#YA/r   c                z    V P                   P                  R ^ ^.4      pV P                  V P                  V4       R# r  )r   rm  r]
  r
  rd
  s   & r   rp  TestSyncManagerTypes.test_arrayq  s0    LLsQF+((!,r   c                    \         P                  ! 4       pVP                  VP                  ^ 4       VP                  VP                  ^4       R# r   )rF   r
  rn   r1  r2  r
  s   && r   _test_namespace$TestSyncManagerTypes._test_namespaceu  s8      """r   c                    V P                   P                  4       p^ Vn        ^Vn        V P	                  V P
                  V4       R# r   )r   r  r1  r2  r]
  r
  rd
  s   & r   r  #TestSyncManagerTypes.test_namespace{  s6    LL""$,,a0r   c                X   \         P                  ! 4       pVP                  . RO4       VP                  \	        V4      ^4       VP                  R V4       VP                  RV4       VRR0,          pVP                  V0 Rm4       RR0V,          pVP                  V0 Rm4       VRR0,          pVP                  V0 Rm4       VP                  V\        P                  P                  4       VP                  4        VP                  . RO4       0 RmV,
          pVP                  VR04       VR R0,
          pVP                  VR04       VR R0,          pVP                  VR04       VP                  V\        P                  P                  4       VP                  4        VP                  . RO4       0 R	mV,          pVP                  VR R04       V0 R	m,          pVP                  VR R04       V0 R	m,          pVP                  VR R04       VP                  V\        P                  P                  4       VP                  4        VP                  . RO4       V0 R	m,          pVP                  VRR04       0 R	mV,          pVP                  VRR04       V0 R	m,          pVP                  VRR04       VP                  V\        P                  P                  4       VP                  4        VP                  . RO4       VP                  \        V4      0 R
m4       R# )r   r   r   r\  r<  Nr   r   r      r   r   r   r\  r<     r   r   r\     r   r   r\     r   r   r   )rF   r
  r  rn   r   rp   r8  r	  r   r   rQ  SetProxyr  r   r   r  r
  r  s   &&  r   _test_set_operator_symbols/TestSyncManagerTypes._test_set_operator_symbols  s     "

?#S1%c3c"Sz!F$=>sc!F$=>SzC!:;c?#;#;#D#DE		

?# 3&FSE*Sz!FSE*SzC#'c?#;#;#D#DE		

?# 3&FS#J/&FS#J/C#s,c?#;#;#D#DE		

?#&FS#J/ 3&FS#J/C#s,c?#;#;#D#DE		

?#CHo6r   c                ^   \         P                  ! 4       pVP                  R 4       VP                  R V4       VP	                  4        VP                  . RO4       VP                  4       pVP                  W14       VP                  R4       VP                  RV4       VP                  \        VP                  R4       VP	                  4        VP                  R.4       VP                  R4       VP                  RV4       VP                  R4       VP                  RV4       VP                  R.4       VP                  4       pVP                  WA4       VP	                  4        VP                  . RO4       VP                  0 Rm4      pVP                  VRR04       VP                  0 Rm4       VP                  VRR04       VP	                  4        VP                  . RO4       VP!                  RR04      pVP                  VR04       VP#                  RR04       VP                  VR04       VP	                  4        VP                  . RO4       VP%                  0 Rm4      pVP                  VRR 04       VP'                  0 Rm4       VP                  VRR 04       R# )r\  r   r   r   Nr
  r
  )rF   r
  addrp   r  r  r   r	  r  r8  ro   r  discardr  intersectionintersection_update
differencedifference_updatesymmetric_differencesymmetric_difference_update)r   r  r
  copy_objpoppedr  s   &&    r   _test_set_operator_methods/TestSyncManagerTypes._test_set_operator_methods  s     "c3		

?#88:H*

3c"(CJJ4		

C5Cc"Cc"

C5%		

?#!!/2FS#J/0C#s,		

?#c
+FSE*sCj)C#'		

?#))/:FS#J/''8C#s,r   c                   \         P                  ! 4       pVP                  . RO4       VP                  RR04      pVP	                  V0 Rm4       VP                  VP                  RR04      4       VP                  VP                  R R04      4       VP                  VP                  0 Rm4      4       VP                  VP                  R R04      4       VP                  V0 Rm4       VP                  V0 Rm4       VP                  VP                  R R04      4       VP                  VP                  0 R	m4      4       VP                  VR 04       VP                  VR R04       R# )
r   r   r\  r<  Nr
  r
  >   r   r   r   r\  r
  r
  )rF   r
  r  unionr	  r   
isdisjointr   issubsetr{  re	  
issupersetr  r  r
  s   &&  r   _test_set_comparisons*TestSyncManagerTypes._test_set_comparisons  s     "

?#C:&F$=>Sz23c
34%9:;sCj1212S/2Sz23893&c3Z0r   c                J   V P                   P                  4       pV P                  V P                  V4       V P                   P                  4       pV P                  V P                  V4       V P                   P                  4       pV P                  V P
                  V4       R # r   )r   r   r]
  r
  r
  r
  rd
  s   & r   test_setTestSyncManagerTypes.test_set  st    LL77;LL77;LL22A6r   c                   V P                   P                  0 Rm4      pV P                  V0 Rm4       V P                   P                  . RO4      pV P                  V0 Rm4       V P                   P                  R ^R^R^/4      pV P                  V0 Rm4       V P                  \        V P                   P                  R4       R# )r   r   r   r	  Nr
  r
  )r   r   r	  ro   rZ  rd
  s   & r   test_set_init"TestSyncManagerTypes.test_set_init  s    LL_-A/LL_-A/LLc1c1c156A/+t||'7'7>r   c                   V P                   P                  4       p0 R kRkRkRkRkRkRkRkRkR	kR
kRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkR kR!kR"kR#kR$kpV P                  V\        \        V4      4      4       R%# )&__and____class_getitem__r  __iand____ior____isub__r  __ixor__r  __or____rand____ror____rsub____rxor____sub____xor____ge____gt____le____lt__r
  r  r   r
  r
  r
  r
  r
  r
  r
  r
  r  r  r
  r
  r
  r  N)r   r   re	  dir)rs   r  set_methodss   &  r   test_set_contain_all_method0TestSyncManagerTypes.test_set_contain_all_method  s   LL	
	
*	
,:	
<F	
HQ	
	
"	
$.	
09	
;C	
EO	
 	
 "	
 $.	
 09	
 ;D	
 		
 		
 !)		
 +3		

 	

 	

 #	

 %1	

 3F	

 HQ	
 	
 2	
 4@	
 BL	
 	
  	
 "*	
 ,B	
 *	
 ,3	
 5=	
 	[#c!f+6r   )r   r  N)r  )r  )r)  )r   )4ry   rz   r{   r|   r}   r   rQ  r  rH
  r  r  r"  r  r  rY
  r]
  r  r  rg
  r  rn
  r  r&  r*  r.  rz
  r}
  r
  r  r
  r
  r
  r
  r
  r
  r  r
  r  r
  rC  r
  rp  r
  r  r
  r
  r
  r
  r
  r
  r   r   r   s   @r   rF
  rF
  h  s    * $,,88M
     MM$0    3  
-  
6  1  /  
,  ) & &<$ & &B$  % 0 0- # #
1 .7 .7` *- *-X 1 1$7?7 7r   rF
  c                   <   a  ] tR tRt o ]! R4      R 4       tRtV tR# )TestNamedResourcei  zspawn specific test.c                   \         P                  pV P                  \         P                  V4       \	        VR RR7      ;_uu_ 4       pVP                  \        P                  ! R4      4       RRR4       \        P                  ! V4      w  r4pV P                  WUP                  R4      R7       R#   + '       g   i     LL; i)rQ  rB  rC  aW                  import multiprocessing as mp
                ctx = mp.get_context('spawn')
                global_resource = ctx.Semaphore()
                def submain(): pass
                if __name__ == '__main__':
                    p = ctx.Process(target=submain)
                    p.start()
                    p.join()
            Nr	  )r   rF  r  rG  rI  r  textwrapdedentr   r  r   r  rs   rK  rL  r  r  rt   s   &     r    test_global_named_resource_spawn2TestNamedResource.test_global_named_resource_spawn  s     !!	((&1&#00AGGHOO 	% 	 	 1 %55f= 	**W"56 10s   &B11C	r\   N)ry   rz   r{   r|   r]   r
  r   r   r   s   @r   r
  r
    s      !787 97r   r
  c                   :   a  ] tR tRt o Rt]R 4       tR tRtV t	R# )_TestAtExiti,  c                >   a ^ RI pV3R lpVP                  V4       R# )r   Nc                     < \        SR 4      ;_uu_ 4       p V P                  R4       RRR4       R#   + '       g   i     R# ; i)rQ  deadbeefN)rI  r  )rL  output_paths    r   exit_handler5_TestAtExit._write_file_at_exit.<locals>.exit_handler3  s-    k3''1
# ('''s	   2A	)atexitr	  )rs   r   r  r  s   &f  r   _write_file_at_exit_TestAtExit._write_file_at_exit0  s    	$ 	%r   c           	        \         P                  ! 4       ;_uu_ 4       p\        P                  P	                  VR 4      pV P                  V P                  V3R7      pVP                  4        VP	                  4        \        V4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z
output.txtr   r
  N)r   temp_dirrB   r   r   r   r  r   rI  rn   rJ  )rs   r  r   r   rL  s   &    r   test_atexit_TestAtExit.test_atexit8  s    !!X'',,x>KD$<$<K>RAGGIFFHk""a  :6 # "!
 #" "!!s$   A2C!C	1CCCC'	r\   Nrg  )
ry   rz   r{   r|   r   r"  r  r  r   r   r   s   @r   r
  r
  ,  s&     "M& &7 7r   r
  c                   p   a  ] tR tRt o RtR0tRR0tR tR t]	R 4       t
R	 t]	R
 4       tR tR tRtV tR# )_TestSpawnedSysPathiC  z>Test that sys.path is setup in forkserver and spawn processes.r   r  rN   c                $   \        \        P                  4      V n        \        P
                  ! R R7      V n        RV n        \        P                  P                  V P                  V P                   R24      p\        VRRR7      ;_uu_ 4       pVP                  R4       RRR4       \        P                   Uu. uF  q3'       g   K  VNK  	  up\        P                  R	&   \        P                  P                  ^ V P                  4       \        P                  P                  ^ R
4       V P                  V P                  V P                  4       \         P"                  ! V P                  4      V n        R#   + '       g   i     L; iu upi )ztest_sys_path-)r^  unique_test_modr  rQ  rB  rC  z# A simple test module
Nri  rU  )r   r   r   _orig_sys_pathtempfilemkdtemp	_temp_dir	_mod_namerB   r   rI  r  r  rp   rS   r   r   r  _ctx)rs   module_pathrA  r   s   &   r   r  _TestSpawnedSysPath.setUpJ  s    "388n!))1AB*ggll4>>dnn5ES3IJ+sW55II01 6"%((0(Qaqq(04>>*2d''););<#//0A0AB	 650s   E:;	F	F:F
	c                    V P                   \        P                  R &   \        P                  ! V P
                  RR7       R# )ri  T)ignore_errorsN)r  r   r   shutilrmtreer  r   s   &r   r  _TestSpawnedSysPath.tearDownW  s'    ))dnnD9r   c                V    V P                  \        \        P                  4      4       R # r   )r   r   r   r<  r"   s   &r   enq_imported_module_names-_TestSpawnedSysPath.enq_imported_module_names[  s    		%$%r   c                   V P                   P                  4       R 8w  d   V P                  R4       V P                  V P                  \
        P                  4       \        P                  P                  P                  4        V P                   P                  RV P                  .4       V P                   P                  4       pV P                   P                  V P                  V3R7      pVP                  4        VP!                  4        VP#                  4       pVP%                  4        V P'                  V P                  V4       R# )r  zforkserver specific test.r:   r   N)r  rP   r   r8  r  r   r<  r   r  r  r
  r	  r   r   r  r   r   r   r    rp   )rs   r   r  child_imported_moduless   &   r   (test_forkserver_preload_imports_sys_path<_TestSpawnedSysPath.test_forkserver_preload_imports_sys_path_  s    99%%'<7MM565""..446		((3T^^D	FIIOOyy  55QD ! B

		!"		dnn&<=r   c                    V P                  \        P                  4        \        P                  ! V4       V P                  R 4       R #   \
         d   pT P                  T4        R p?R # R p?ii ; ir   )r   r   r   	importlibimport_moduleImportError)r#   mod_namerw  s   && r   enq_sys_path_and_import+_TestSpawnedSysPath.enq_sys_path_and_importo  sQ    		#((	##H- IIdO  	IIcNN	s   A
 
A1A,,A1c                6   V P                   P                  4       pV P                   P                  V P                  WP                  3R 7      pVP                  4        VP                  4        VP                  4       pVP                  4       pVP                  4        V P                  RV4       V P                  V P                  V4       V P                  VR,          \        P                  R,          4       V P                  VRV P                   2R7       R# )r   rU  r6  zchild could not import r	  N)r  r   r   r'  r  r   r   r   r    r8  rp   r  rn   r   r   r  )rs   r   r  child_sys_pathimport_errors   &    r   test_child_sys_path'_TestSpawnedSysPath.test_child_sys_pathy  s    IIOOyy  331nn:M ! O

		uuw		^,dnnn5+SXXb\:,.EdnnEU,VWr   c                T   \         P                  ! 4       R 8w  d   V P                  R4       \        P                  P                  V P                  R4      p\        P                  P                  VR4      p\        P                  ! V4       \        VR4      ;_uu_ 4       pRpVP                  V4       RRR4       \        P                  P                  \        P                  P                  \        4      R4      pRV P                  /p\        P                  P                  P                  ! V3/ VB w  rxp	V P!                  V	P#                  4       P%                  4       R	4       V P!                  VP#                  4       P%                  4       R
4       R#   + '       g   i     L; i)r  zforkserver specific testpreloaded_modulez__init__.pyrQ  zif 1:
                import sys
                print('stderr', end='', file=sys.stderr)
                print('stdout', end='', file=sys.stdout)
            Nzmp_preload_flush.py
PYTHONPATHr  r  )r   rP   r   rB   r   r   r  mkdirrI  r  r4  r5  r  r   r   r  rn   r  rb  )
rs   r4  	init_namerL  r  r,   envr  r  rt   s
   &         r   &test_std_streams_flushed_after_preload:_TestSpawnedSysPath.test_std_streams_flushed_after_preload  s#    ++-=MM45
 '',,t~~/ABGGLL-8	
)S!!QC
 GGCL " ww||BGGOOH57LMT^^,ll00AA$N#N 	,,.9,,.9 "!s    FF'	)r  r  r  r  N)ry   rz   r{   r|   r}   r   r   r  r  r%  r  r   r'  r,  r4  r   r   r   s   @r   r  r  C  sa     H MM!7+MC: & &>   X: :r   r  c                   N   a  ] tR tRt o R t]! R4      R 4       tR tR tRt	V t
R# )	MiscTestCasei  c                b    \         P                  ! V \        \        P                  R R.R7       R# )SUBDEBUGrJ  )extranot_exportedN)r   check__all__r   r@  r   s   &r   test__all__MiscTestCase.test__all__  s%    T?/:Q:Q+5|*D	Fr   r	  c                    \         P                  ! R R4      w  rpV P                  V^ 4       V P                  W3P	                  R4      R7       R# )r  zif 1:
            import sys
            sys.executable = None
            assert "multiprocessing" not in sys.modules, "already imported!"
            import multiprocessing
            import multiprocessing.spawn  # This should not fail
rB  r	  N)r   r  rn   r   r  )rs   r  r  rt   s   &   r   ,test_spawn_sys_executable_none_allows_import9MiscTestCase.test_spawn_sys_executable_none_allows_import  sM     %55F
 	Q**W"56r   c                   \         P                  pV P                  \         P                  V4       \	        VR RR7      ;_uu_ 4       pVP                  \        P                  ! R4      4       RRR4       \        P                  ! V4      w  r4pV P                  RVP                  R4      P                  4       4       V P                  WUP                  R4      R7       R#   + '       g   i     L{; i)rQ  rB  rC  z                import multiprocessing
                def f(x): return x*x
                if __name__ == '__main__':
                    with multiprocessing.Pool(200) as p:
                        print(sum(p.map(f, range(1000))))
            N	332833500r	  )r   rF  r  rG  rI  r  r
  r
  r   r  rn   r  r  r   r
  s   &     r   test_large_poolMiscTestCase.test_large_pool  s     !!	((&1&#00AGGHOO %   1 %55f=cjj&9&?&?&AB**W"56 10s   &C  C0	c                  aa \         P                  ! 4       R 8w  d   V P                  R4       \         P                  ! 4       o\        P
                  ! V3R lRR7      oV3R lp\         P                  ! VR7      pVP                  4        VP                  \        P                  4       V P                  VP                  ^ 4       V P                  SP                  4       R4       \        S4       R# )	rj   zfork specific testc                  &   < S P                  R 4      # )doner   rk  s   r   rI  =MiscTestCase.test_forked_thread_not_started.<locals>.<lambda>  s    AEE&Mr   Tr  c                  H   < S P                  4        S P                  4        R # r   )r   r   )r   s   r   rN	  :MiscTestCase.test_forked_thread_not_started.<locals>.child  s    GGIFFHr   r   rH  N)r   rP   r   r   rA  r  r   r   r   r   r0  rn   r   r  r$   )rs   rN	  r   r   r   s   &  @@r   test_forked_thread_not_started+MiscTestCase.test_forked_thread_not_started  s     ++-7MM./!!#$9$G	 ##51			w$$%Q'0Ar   r\   N)ry   rz   r{   r|   r=  r]   r@  rD  rL  r   r   r   s   @r   r7  r7    s4     F
 !!<=7 >7"7$ r   r7  c                   @   a  ] tR tRt o ]R 4       t]R 4       tRtV tR# )	BaseMixini  c                    \         P                  P                  P                  4       \        P                  P                  4       3V n        R # r   )r   r&   	_danglingr   rA  danglingrQ  s   &r   r  BaseMixin.setUpClass  s5    '//99>>@!++0024r   c                   \         P                  P                  4        \        \        P
                  P                  4      \        V P                  ^ ,          4      ,
          pV'       d/   R\         P                  n        \        P                  ! RV 24       Rp\        \        P                  4      \        V P                  ^,          4      ,
          pV'       d/   R\         P                  n        \        P                  ! RV 24       RpR# )r   TDangling processes: NDangling threads: )r  r   r  r   r   r&   rQ  rR  rV
  rW
  rA  )r   r   r   s   &  r   r  BaseMixin.tearDownClass  s     	!//99:Sa=QQ	/3DLL,!!$8"DE	i))*Sa-AA/3DLL,!!$6wi"@Ar   r\   N)	ry   rz   r{   r|   r"  r  r  r   r   r   s   @r   rO  rO    s+     4 4  r   rO  c                      ] tR tRtRt]P                  t]P                  t]! ]P                  4      t	]! ]P                  4      t
]! ]P                  4      t]! ]P                  4      t]! ]P                  4      t]! ]P                  4      t]! ]P                  4      t]! ]P                   4      t]! ]P"                  4      t]! ]P$                  4      t]! ]P&                  4      t]! ]P(                  4      t]! ]P*                  4      t]! ]P,                  4      t]! ]P.                  4      t]! ]P0                  4      t]! ]P2                  4      t]! ]P4                  4      t]! ]P6                  4      tRtR# )r|  i  r   r\   N)ry   rz   r{   r|   r   r   r   r  r%  r   r  r9  r   r  r  r   r  r  r  r)  r-  rN  r7  r  r   rm  r@  rl  r   r\   r   r   r|  r|    sN   D%%G ++J"?#B#BCO!/"@"@AN"?#B#BCO!/"@"@AN,,-D,,-D../E !>!>?M,,-D../E_667I#O$D$DE_667I../E?223G../E../EO445HO445Hr   r|  c                     a a ] tR tRt oRt]P                  t]! ]P                  ! R4      4      t
]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R	4      4      t]! ]P                  ! R
4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]! ]P                  ! R4      4      t]R 4       t]V 3R l4       t]V 3R l4       tRtVtV ;t# )ManagerMixini  r   zmanager.Queuezmanager.JoinableQueuezmanager.Lockzmanager.RLockzmanager.Semaphorezmanager.BoundedSemaphorezmanager.Conditionzmanager.Eventzmanager.Barrierzmanager.Valuezmanager.Arrayzmanager.listzmanager.dictzmanager.Namespacec                :    V P                   P                  ! V/ VB # r   )r   r  )r   rQ   r   s   &*,r   r  ManagerMixin.Pool/  s    {{...r   c                X   < \         SV `  4        \        P                  ! 4       V n        R # r   )r  r  r   r  r   r  s   &r   r  ManagerMixin.setUpClass3  s    %--/r   c                "  < \         p\        P                  ! 4       p\        P                  ! VR R7       F(  p\        \        P                  ! 4       4      ^8:  g   K(   MZ	  \        P                  ! 4       V,
          pR\        n        \        P                  ! R\        P                  ! 4        RVR R24       \        P                  ! 4        V P                  P                  4       ^ 8w  dZ   R\        P                  n        \        P                  ! R4       \        P                  ! V P                  P                  4       4       V P                  P!                  4        V P                  P#                  4        RV n        \$        SV `M  4        R# )	FrP
  TrR
  rS
  rT
  rd  z5Shared objects which still exist at manager shutdown:N)rU
  r   r   r   r:  r   r   r9  rV
  rW
  r  r  r   _number_of_objectsr  _debug_infor   r   r  r  )r   r5   rX
  r  rr  r   s   &    r   r  ManagerMixin.tearDownClass8  s%   
 /^^%
''u=A?2245: > !J.B*.G'!!$F%4%D%D%F$G H;;=c((#L M 	

;;))+q0 04DLL,!! #9 :!!#++"9"9";<r   r\   )ry   rz   r{   r|   r   r   r   r  operator
attrgetterr   r  r  r  r)  r-  rN  r7  r  r   rm  r   r  r  r"  r  r  r  r   r   r  r  s   @@r   rZ  rZ    s    D%%GX((9:EX001HIJMH''78DX((9:E,,-@ABI 3 34N OP,,-@ABIX((9:Ex**+<=>GX((9:EX((9:EH''78DH''78D,,-@ABI/ / 0 0      r   rZ  c                      ] tR tRtRt]P                  P                  t]P                  P                  t]	! ]P                  P                  4      t
]	! ]P                  P                  4      t]	! ]P                  P                  4      t]	! ]P                  P                  4      t]	! ]P                  P                  4      t]	! ]P                  P                  4      t]	! ]P                  P                   4      t]	! ]P                  P"                  4      t]	! ]P                  P$                  4      t]	! ]P                  P&                  4      t]	! ]P                  P(                  4      t]	! ]P                  P*                  4      t]	! ]P                  P,                  4      t]	! ]P                  P.                  4      t]	! ]P                  P0                  4      tRtR# )ThreadsMixiniY  r   r\   N)ry   rz   r{   r|   r   r   r	  r   r  r%  r   r9  r  r  r   r  r  r  r)  r-  rN  r7  r  r   rm  r   r\   r   r   rf  rf  Y  st   D##++G &&11J"?#8#8#H#HIO"?#8#8#H#HIO--223D--223D..445E !6!6!D!DEM--223D..445E_22<<=I#O$9$9$J$JK_22<<=I..445E?00889G..445E..445Er   rf  c           	        aaa V R ,          p\        4       p0 RmpVP                  4        EF  w  rx\        V\        4      '       g   K  \	        V\
        4      '       Ed    V\
        J d   KA  VP                  '       d   SVP                  9  d   Kf  VP                   F  p	V'       d	   W8w  d   K  V'       d   K  RV	P                  4       ,           VR,          ,           p
WYP                  4       R,           ,          p ! R RW\        P                  4      pV	R8X  d   \        P                  ! R4      ! V4      pV
;Vn        Vn        WLn        SVn        WV
&   K  	  EK4  \	        V\        P                  4      '       g   EKW  V'       d   EKb   ! R RV\"        4      pV;Vn        Vn        WLn        WV&   EK  	  R	R	.oR	.oVVV3R
 lpVV3R lpWR&   WR&   R	# )ry   r   Withr6  Mixinc                       ] tR tRtRtR# )*install_tests_in_module_dict.<locals>.Tempi  r\   Nr  r\   r   r   Temprk    s    r   rl  r-  c                       ] tR tRtRtR# )rk  i  r\   Nr  r\   r   r   rl  rk    s    r   Nc                    < \         P                  ! \        4       \         P                  P	                  4        \         P                  P
                  P                  4       S^ &   \        P
                  P                  4       S^&   \         P                  ! RR7      S^ &    \         P                  ! SRR7       \        P                  P                  R4      '       d    \         P                   ! 4       p \%        4        \&        P(                  ! 4        \         P*                  ! 4       P-                  \.        4       R#   \         d    \        P                  ! SR,           4      hi ; i  \"         d    \        P                  ! R4      hi ; i)r   Trf   rh   z start method not supportedlinuxz1OSError raises on RLock creation, see issue 3111!N)r   r	  r	  r&   _cleanuprQ  r   rA  rP   rm   rE   rF   rG   r   r   r  r  r  rJ   r   get_temp_dirrH  rI  rM  )r  rR  old_start_methodrS   s    r   setUpModule1install_tests_in_module_dict.<locals>.setUpModule  s5   ..w7((*%--77<<>))..0->>$O	C,,\F
 <<""7++;&,,. 	 !""$--i8  	C##L$A%B C C	C  ;'' ): ; ;;s   !D= E) =)E&)"Fc                    < R p \         P                  P                  4        \        P                  ! S^ ,          RR7       \        \        P                  P                  4      \        S^ ,          4      ,
          pV'       d1   Rp R\         P                  n        \        P                  ! RV 24       Rp\        \        P                  4      \        S^,          4      ,
          pV'       d1   Rp R\         P                  n        \        P                  ! RV 24       RpV '       d   \        P                  ! R4       \        P                  P                  4        R# )FTrh   rU  NrV  r  )r  r   r  r   rm   r   r&   rQ  rV
  rW
  rA  r   r-  r   _cleanup_tests)
need_sleepr   r   rR  rr  s      r   tearDownModule4install_tests_in_module_dict.<locals>.tearDownModule  s    
 	!(()9!)<DI//99:S!=MM	J/3DLL,!!$8"DE	i))*S!-==J/3DLL,!!$6wi"@A JJsO++-r   rs  rx  >   r   r   r   )globalsr  r   r;  
issubclassr   r   r   
capitalizerF   r
  r   requires_hashdigestry   r{   rz   rS   r  )remote_globsrS   	only_typeexclude_typesrz   local_globs	ALL_TYPESr,   basetype_newnameri  rl  rs  rx  rR  rr  s   &f&&           @@r   install_tests_in_module_dictr  q  s   j)J)K3I!'')
$%%dL))|#!!!l$:L:L&L++!3  5#3#3#55R@#$4$4$6$@A4(9(9 I%)==hGMD4;; 1",$0!(,W% , h//00tV 044DMD-(O!%A *D d|Hv9,.: #.%3!"r   SemLockzSemLock not availablero  z
Linux onlyc                   &   a  ] tR tRt o R tRtV tR# )SemLockTestsi  c                     ! R  R\         P                  4      pR\        P                  ! 4        2pV! ^^ ^
VR4      p\         P	                  V4       R# )c                       ] tR tRtRtR# )3SemLockTests.test_semlock_subclass.<locals>.SemLocki  r\   Nr  r\   r   r   r  r    r  r   r  ztest_semlock_subclass-FN)r   r  rB   r   
sem_unlink)rs   r  r,   r   s   &   r   test_semlock_subclass"SemLockTests.test_semlock_subclass  sG    	&.. 	'		}5Aq"dE*##D)r   r\   N)ry   rz   r{   r|   r  r   r   r   s   @r   r  r    s     * *r   r  )r3   N)rL  r  )NF)rF   unittest.mockr#   r|  r
  r   r  r   r   rB   r  r#  r5  rX   rZ  rn  collections.abcr  r  r!  rW  r  r  r  r  rc  r  r  r  test.supportr  test.support.script_helperr   r   r   r   r   r   r	   r
   r$  r   *skip_if_broken_multiprocessing_synchronizerA  r	  r   multiprocessing.dummymultiprocessing.heapmultiprocessing.managersr  multiprocessing.queuesr   r   r   HAVE_SEND_HANDLEr  r%  multiprocessing.sharedctypesr   r   r   r   	HAS_SHMEMr  HAVE_ASAN_FORK_BUGrG   rp  r   r$   r'   r,   r)   r.   rJ  rM  r  r   r~  r  r  r0  r  rU
  r  HAVE_GETVALUEr   r  r6   rC   r  r	  ctypesr;   r<   r=   r>   r  rJ   r]   r
  r_   r   r   r   r   r   r   r'  r9  rl  rp  rr  r  r"  r3  r  r  r  r  r  r  r0  rb  r  r  r  r  r  r  rE   r  r  r  r  r  r  r  r  r  rZ  r  r  r  r  r	  r  r   r  r  r  r  r  r  r}  r/  r;  rB  rZ  rW  r  r  r  r#  r  r  r>  rB  rU  r  r1  rF  rq  r  r  r  r  r  r  r  r  r  r  r  r  r+	  r5	  rL	  rY	  r_	  rj	  r	  r	  r~   r	  r
  r-
  rF
  r
  r
  r  r7  rO  r|  rZ  rf  r  rk  r  r\   r   r   <module>r     s=	  
      	  
 	 	                   !  ' & " & & ) ( !../AB   2 2 4  !      +  )..M8-I
  

]
^^
 	* 77g05 OO	 	 #'s Hh#&S Hh (( " ,6? ? 
	 #
JJ}%E
 =
>)==K2LX.. L@0F 0"6 <
*  a
< a
N /))  ,Q7l Q7n$Q Ql
y$ y$x3@\ 3@ll\ l^	5W 5W@& &.
6F 6r x1< x1|C/ C/LM/ M/fw(l w(z$$F $ %: $u! u!n&L &PB l B P I HV ,I ,	 	 
  56  * 	  56;  ? 	  53-  @4>\ 4>v 
/; /   kI  6KK K   { # 
. .b ##H-22, 22 .22j) )%H-- %D 9G/l G/R78L 78t., .`L Ld 
]$JK##H-@| @ . L@Lb bP
9 
5) 5)p 
Y HI##H-  . JJuL ux!.h'' !.NB< Bx6\ 6DE)) E& ##H-5!! 5 .5< ##E*##H-5H-- 5 . +5N ##H-*x(( * .*< *'!2!2 '*gx   gZ
B)) 
B 8!! 8H28$$ 2D'X&& '"1h// 1><:8$$ <:DAh'' AFL7h'' L7^ 
(=?UE(++ UE?UEn9.h'' 9.x&:x00 &:R ##H-f78,, f7 .f7R7)) 747, 7.`:, `:F>8$$ >J 26Y 629 9 9 x69 60_4D 
W-y99;RS	(,7*8$$ * 8 T*m\  M    I
  FPE  )I$((E(Hz)sf   1`( 
`8 a a <a( a2 (	`54`58	aa	aa	a%$a%(a/2bb