+
    BiE                    :   ^ RI t ^ RIt^ RIt^ RIt^ RIH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 ]P                  ! R4      t^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHtHtHt ^RIHtHtHtH t H!t!H"t" Rt#Rt$Rt%Rt&Rt'Rt(R t)] PT                  RR/R l4       t+R=R lt, ! R R] 4      t- ! R R] 4      t. ! R R] 4      t/ ! R R] 4      t0 ! R  R!] 4      t1 ! R" R#] 4      t2 ! R$ R%] 4      t3 ! R& R'] 4      t4 ! R( R)] 4      t5 ! R* R+] 4      t6]Pn                  t8]Pr                  t:]Pv                  t<R, t=R- t>R. t?R/ t@R0 tAR1 tB ! R2 R34      tCR>R4R/R5 lltD ! R6 R7] 4      tE ! R8 R9] 4      tF ! R: R;] 4      tG]HR<8X  d   ]P                  ! 4        R# R# )?    N)dedent)support)	os_helper)script_helper)import_helper_interpreters)interpreters)Py_GIL_DISABLED)force_not_colorized)InterpreterErrorInterpreterNotFoundErrorExecutionFailed)_captured_script_run_output_runningTestBaserequires_test_modules_testinternalcapiunknownzruntime initlegacy C-APIC-APIcross-interpreter C-APIz_interpreters modulec                 X     \         P                  ! V 4       R#   \         d     R # i ; i)FT)pickledumps	Exception)objs   &6/usr/lib/python3.14/test/test_interpreters/test_api.pyis_pickleabler   %   s,    S   s    ))removeFc             #      "   ^ RI p\        V4      pW9  g   Q h\        WV4       V'       d   VP                  V 4      x  R#  W@,          x  VP                  V R4       R#   TP                  T R4       i ; i5ir   N)__main__varsexecpop)namescriptr    mainmodmainnss   &&$  r   defined_in___main__r+   -   sb     ']F jj	#,JJtT"FJJtT"s   AA9
A" A9"A66A9c                    \        V \        4      '       dV   \        V \        4      '       g   Q V 4       h\        P
                  ! V P                  V P                  V P                  R 7      p M\        V \        4      '       dN   V P                  V 4      w  rEpV'       g   V\        9   d   Rp\        P
                  ! TT T;'       g    RR 7      p M"\        V \        P
                  4      '       g   Q hVe   \        V\        4      '       g   Q V4       hVe   \        V\        4      '       g   Q V4       hVe   \        V\        4      '       g   Q V4       h\        P
                  ! V VVVR7      # ))__name____qualname__
__module__builtinsN)typemsg	formatted
errdisplay)
isinstancer1   
issubclassBaseExceptiontypesSimpleNamespacer-   r.   r/   str
rpartition__builtins__)exctyper2   r3   r4   module_r'   s   &&&&   r   build_excinfor@   <   s3   '4  '=11:7:1''%% --))

 
GS	!	!!,,W54$,.F'' ~~
 '5#8#89999;*S#..33.Is!;!;FYF;J!<!<HjH<  	     c                   &   a  ] tR t^Zt o R tRtV tR# )ModuleTestsc                    \         P                  \         P                  \         P                  \         P                  .p\         P                  \         P                  \         P                  \         P                  .pV P                  W!4       R # N)r	   create_queueQueue
QueueEmpty	QueueFullassertEqual)selffirstseconds   &  r   test_queue_aliasesModuleTests.test_queue_aliases\   sj    %%##""	
 %%##""	
 	'rA    N)r-   r/   r.   __firstlineno__rN   __static_attributes____classdictcell____classdict__s   @r   rC   rC   Z   s     ( (rA   rC   c                   >   a  ] tR t^lt o R tR tR tR tR tRt	V t
R# )CreateTestsc                   \         P                  ! 4       pV P                  V\         P                  4       V P	                  V\         P
                  ! 4       4       V P                  \        \        P                  R 4       R# )u   N)	r	   createassertIsInstanceInterpreterassertInlist_allassertRaisesUnicodeEncodeErrorr   rK   interps   & r   test_in_mainCreateTests.test_in_mainn   sX    $$&fl&>&>?fl3356 	,m.B.BHMrA   c                J  aa \         P                  ! 4       oR oVV3R lp\         P                  ! VR7      pS;_uu_ 4        VP                  4        R R R 4       VP	                  4        V P                  S\        P                  ! 4       4       R #   + '       g   i     LG; i)Nc                  r   < \         P                  ! 4       o SP                  4        SP                  4        R # rE   )r	   rY   acquirerelease)ra   locks   r   f%CreateTests.test_in_thread.<locals>.fy   s#    !((*FLLNLLNrA   target)	threadingLockThreadstartjoinr\   r	   r]   )rK   ri   tra   rh   s   &  @@r   test_in_threadCreateTests.test_in_threadv   sf    ~~	
 A&TGGI 	fl3356 Ts   BB"	c                   \         P                  ! 4       w  p\         P                  ! 4       p\        V\	        R 4      4      p\         P
                  ! \        V4      4      pV P                  \         P                  ! 4       WV.4       R# )z
            from concurrent import interpreters
            interp = interpreters.create()
            print(interp.id)
            N)r	   r]   rY   r   r   r[   intrJ   )rK   mainra   outinterp2s   &    r   test_in_subinterpreter"CreateTests.test_in_subinterpreter   sl    %%'$$&&& * # 
 **3s84..042IJrA   c                |   \        \        P                  ! 4       4      p. p\        ^4       F)  p\        P                  ! 4       pVP                  V4       K+  	  V F  pVP                  4        K  	  \        P                  ! 4       pV P                  \        \        P                  ! 4       4      W0,          4       R#    N)setr	   r]   rangerY   appendcloserJ   )rK   before
interp_lstr?   interpsra   s   &     r   test_after_destroy_all"CreateTests.test_after_destroy_all   s    \**,-
qA"))+Gg&  !FLLN ! $$&\2245v7HIrA   c                   \        \        P                  ! 4       4      p\        P                  ! 4       p\        P                  ! 4       p\        P                  ! 4       pVP	                  4        VP	                  4        \        P                  ! 4       pV P                  \        \        P                  ! 4       4      WV0,          4       R # rE   )r   r	   r]   rY   r   rJ   )rK   r   interp1ry   interp3ra   s   &     r   test_after_destroy_some#CreateTests.test_after_destroy_some   s    \**,-%%'%%'%%'$$&\2245v&@Q7QRrA   rP   N)r-   r/   r.   rQ   rb   rs   rz   r   r   rR   rS   rT   s   @r   rW   rW   l   s(     N7	KJS SrA   rW   c                   2   a  ] tR t^t o R tR tR tRtV tR# )GetMainTestsc                h    \         P                  ! 4       pV P                  VP                  ^ 4       R# r"   )r	   get_mainrJ   idrK   rw   s   & r   test_idGetMainTests.test_id   s$    $$&!$rA   c                |    \         P                  ! 4       p\         P                  ! 4       pV P                  W4       R # rE   )r	   r   get_currentassertIsrK   rw   currents   &  r   test_currentGetMainTests.test_current   s*    $$&**,d$rA   c                |    \         P                  ! 4       p\         P                  ! 4       pV P                  W4       R # rE   )r	   r   r   )rK   main1main2s   &  r   test_idempotentGetMainTests.test_idempotent   s*    %%'%%'e#rA   rP   N)	r-   r/   r.   rQ   r   r   r   rR   rS   rT   s   @r   r   r      s     %%
$ $rA   r   c                   B   a  ] tR t^t o R tR tR t]R 4       tRt	V t
R# )GetCurrentTestsc                |    \         P                  ! 4       p\         P                  ! 4       pV P                  W!4       R # rE   )r	   r   r   rJ   r   s   &  r   	test_mainGetCurrentTests.test_main   s,    $$&**,'rA   c                   \         P                  ! 4       p\         P                  ! 4       p\        V\	        R 4      4      p\         P
                  ! \        V4      4      pV P                  WB4       V P                  WA4       R# )z
            from concurrent import interpreters
            cur = interpreters.get_current()
            print(cur.id)
            N)	r	   r   rY   r   r   r[   rv   rJ   assertNotEqual)rK   rw   ra   rx   r   s   &    r   test_subinterpreter#GetCurrentTests.test_subinterpreter   sh    $$&$$&&& * # 
 **3s84)G*rA   c                   V P                  R 4      ;_uu_ 4        \        P                  ! 4       p\        P                  ! 4       pV P                  W4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! 4       p\        V\        R4      4      pR VP                  4        4       w  rVV P                  WV4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! 4       p\        V\        R4      4      p\        V4      p\        V4      pV P                  Wx4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)rw   Nsubinterpreterz
                from concurrent import interpreters
                cur = interpreters.get_current()
                print(id(cur))
                cur = interpreters.get_current()
                print(id(cur))
                c              3   8   "   T F  p\        V4      x  K  	  R # 5irE   )rv   ).0vs   & r   	<genexpr>2GetCurrentTests.test_idempotent.<locals>.<genexpr>   s     ?.>c!ff.>s   zper-interpreterz
                from concurrent import interpreters
                cur = interpreters.get_current()
                print(id(cur))
                )subTestr	   r   r   rY   r   r   
splitlinesrJ   rv   r   r   )	rK   cur1cur2ra   rx   objid1objid2id1id2s	   &        r   r   GetCurrentTests.test_idempotent   s   \\&!!++-D++-DMM$% "
 \\*++!((*Fff . ' C @cnn.>?NFV, , \\+,,!((*Fff . ' C
 c(CV*C) -,# "!
 ,+ -,,s%   <E	7AE-AE/	E	E,	/F 	c                    \         P                  ! 4       pV P                  R \        P                   R24      p\        V4      w  r4V P                  W14       V P                  V\        4       R# )
            import z{ as interpreters
            interp = interpreters.get_current()
            print((interp.id, interp.whence))
            N)r   next_interpreter_idrun_temp_from_capir	   r-   evalrJ   WHENCE_STR_CAPI)rK   expectedtextinterpidwhences   &    r   test_created_with_capi&GetCurrentTests.test_created_with_capi   sg    $88:&& , ))* +( 
  :,1rA   rP   N)r-   r/   r.   rQ   r   r   r   r   r   rR   rS   rT   s   @r   r   r      s(     (

+*: 	2 	2rA   r   c                   >   a  ] tR t^t o R tR tR tR tR tRt	V t
R# )ListAllTestsc                f    \         P                  ! 4       pV P                  ^\        V4      4       R#    N)r	   r]   rJ   len)rK   r   s   & r   test_initialListAllTests.test_initial   s$    '')CL)rA   c                Z   \         P                  ! 4       p\         P                  ! 4       p\         P                  ! 4       p. p\         P                  ! 4        F  pVP	                  VP
                  4       K   	  V P                  WAP
                  VP
                  VP
                  .4       R # rE   )r	   r   rY   r]   r   r   rJ   rK   rw   rL   rM   idsra   s   &     r   test_after_creating ListAllTests.test_after_creating   sw    '')##%$$&"++-FJJvyy! . 	ww&))<=rA   c                d   \         P                  ! 4       p\         P                  ! 4       p\         P                  ! 4       pVP                  4        . p\         P                  ! 4        F  pVP                  VP                  4       K   	  V P                  WAP                  VP                  .4       R # rE   )r	   r   rY   r   r]   r   r   rJ   r   s   &     r   test_after_destroying"ListAllTests.test_after_destroying
  sz    '')##%$$&"++-FJJvyy! . 	ww		23rA   c                "   \         P                  ! 4       p\         P                  ! 4       p\         P                  ! 4       pWV.p\         P                  ! 4       pV P	                  WT4       \        WT4       F  w  rgV P                  Wg4       K  	  R # rE   )r	   r   rY   r]   rJ   zipr   )rK   rw   rL   rM   r   actualr   ry   s   &       r   r   ListAllTests.test_idempotent  sp    '')##%$$&(&&(* #F 5GMM'+ !6rA   c                J   \         P                  4       vr\         P                  4       p\         P                  4       p\         P                  4       pV^,           pV^,           pV\        3V\        3V\        3V\        3V\
        3V\        3.pVRR p	V P                  R\        P                   R24      p
\        V
4      p\        P                  ! 4        Uu. uF  qP                  VP                  3NK  	  ppV P                  W4       V P                  W4       R# u upi )r   Nr   z as interpreters
            interp = interpreters.create()
            print(
                [(i.id, i.whence) for i in interpreters.list_all()])
            )r   r   rY   WHENCE_STR_RUNTIMEWHENCE_STR_STDLIBr   r   r	   r-   r   r]   r   r   rJ   )rK   mainidr?   	interpid1	interpid2	interpid3	interpid4	interpid5r   	expected2r   resires2s   &             r   r   #ListAllTests.test_created_with_capi"  s   "++-
!((*	!((*	!((*	M	M	'()*)*)*()*
 SbM	&& , ))* +(  4j*6*?*?*AB*AQqxx *AB') Cs    D rP   N)r-   r/   r.   rQ   r   r   r   r   r   rR   rS   rT   s   @r   r   r      s#     *	>
4
,* *rA   r   c                   h   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RtV tR# )InterpreterObjectTestsi>  c                    \         P                  ! 4       P                  p\         P                  ! V4      pV P	                  VP                  V4       R # rE   )r	   r   r   r[   rJ   rK   r   ra   s   &  r   test_init_int$InterpreterObjectTests.test_init_int@  s:    ++-00))(3H-rA   c                    \         P                  ! 4       P                  p\         P                  ! V4      pV P	                  VP                  V4       R # rE   )r	   r   _idr[   rJ   r   s   &  r   test_init_interpreter_id/InterpreterObjectTests.test_init_interpreter_idE  s:    ++-11))(3X.rA   c           
        \         P                  ! 4       P                  p\        V4      \	        V4      \        4       R R3 Fj  pV P                  \        V4      4      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \         P                  ! V4       R R R 4       R R R 4       Kl  	  R #   + '       g   i     L; i  + '       g   i     K  ; i)N )r	   r   r   r:   floatobjectr   reprr^   	TypeErrorr[   )rK   actualidr   s   &  r   test_init_unsupported,InterpreterObjectTests.test_init_unsupportedJ  s    ++-00M(OH
H d8n--&&y11 ,,X6 2 .-
 21 .--s$   &CB1C1C<CCc                    \         P                  ! 4       p\         P                  ! VP                  4      pV P	                  W!4       R # rE   )r	   r   r[   r   r   rK   rw   ra   s   &  r   r   &InterpreterObjectTests.test_idempotentW  s0    $$&))$''2f#rA   c                    V P                  \        4      ;_uu_ 4        \        P                  ! R 4       RRR4       R#   + '       g   i     R# ; ii@B N)r^   r   r	   r[   rK   s   &r   test_init_does_not_exist/InterpreterObjectTests.test_init_does_not_exist\  s1    788$$Y/ 9888	   ?A	c                    V P                  \        4      ;_uu_ 4        \        P                  ! R4       RRR4       R#   + '       g   i     R# ; i)r   N)r^   
ValueErrorr	   r[   r  s   &r   test_init_bad_id'InterpreterObjectTests.test_init_bad_id`  s0    z**$$R( +***r  c                D   \         P                  ! 4       p\         P                  ! 4       p\         P                  ! 4       pV P	                  VP
                  \        4       V P	                  VP
                  \        4       V P	                  VP
                  \        4       R # rE   )r	   r   r   rY   rZ   r   rv   )rK   rw   r   ra   s   &   r   test_id_type#InterpreterObjectTests.test_id_typed  sh    $$&**,$$&dggs+gjj#.fii-rA   c                    \         P                  ! 4       pV P                  \        4      ;_uu_ 4        R Vn        RRR4       R#   + '       g   i     R# ; ir   )r	   rY   r^   AttributeErrorr   r`   s   & r   test_id_readonly'InterpreterObjectTests.test_id_readonlyl  s7    $$&~..!FI /...s   AA	c           
     J   \         P                  ! 4       p\         P                  ! 4       pV P                  R 4      ;_uu_ 4        V P	                  VP
                  \        4       RRR4       V P                  R4      ;_uu_ 4        V P	                  VP
                  \        4       RRR4       V P                  R4      ;_uu_ 4        V P                  R\         P                   R24      p\        V4      pV P	                  V\        4       RRR4       V P                  R4      ;_uu_ 4        R\        \        \        \        3 F[  pV P                  \        4      ;_uu_ 4        WRn        RRR4       V P                  \        4      ;_uu_ 4        WQn        RRR4       K]  	  RRR4       R#   + '       g   i     ELS; i  + '       g   i     EL%; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     K  ; i  + '       g   i     R# ; i)rw   Nfrom _interpreters
from C-APIz
                import z as interpreters
                interp = interpreters.get_current()
                print(repr(interp.whence))
                readonly)r	   r   rY   r   rJ   r   r   r   r   r-   r   r   WHENCE_STR_UNKNOWNr^   r  )rK   rw   ra   r   r   values   &     r   test_whence"InterpreterObjectTests.test_whenceq  s~   $$&$$&\\&!!T[[*<= " \\.//V]],=> 0 \\,''** 0$--. /, D
 $ZFV_5 ( \\*%%""! &&~66$)M 7&&~66"'K 76 &% "!! 0// ('" 76666 &%%sa   !F/!GAG.8H&G*-%HG=H/G 	G	G'	*G:5H=H	HH"	c                    \         P                  ! 4       p\        VP                  4      p\        V4      pV P	                  W24       R # rE   )r	   rY   hashr   rJ   )rK   ra   r   r   s   &   r   test_hashable$InterpreterObjectTests.test_hashable  s4    $$&		?f*rA   c                    \         P                  ! 4       p\         P                  ! 4       pV P                  W4       V P                  W4       R # rE   )r	   rY   rJ   r   )rK   r   ry   s   &  r   test_equality$InterpreterObjectTests.test_equality  s:    %%'%%'*G-rA   c                f   \         P                  ! 4       p\        \        P                  ^,           4       Fc  pV P                  VR7      ;_uu_ 4        \        P                  ! W4      p\        P                  ! V4      pV P                  WA4       RRR4       Ke  	  R#   + '       g   i     Kz  ; i)r   )protocolN)	r	   rY   r   r   HIGHEST_PROTOCOLr   r   loadsrJ   )rK   ra   r!  data	unpickleds   &    r   test_pickle"InterpreterObjectTests.test_pickle  sw    $$&f559:Hx00||F5"LL.	  3 10 ;000s   >BB0rP   N)r-   r/   r.   rQ   r   r   r   r   r  r  r  r  r  r  r  r&  rR   rS   rT   s   @r   r   r   >  sG     .
/
7$
0)."
(@+.4 4rA   r   c                   t   a  ] tR tRt o R t]P                  ! R4      R 4       tR tR t	R t
R tR	 tR
tV tR# )TestInterpreterIsRunningi  c                n    \         P                  ! 4       pV P                  VP                  4       4       R # rE   )r	   r   
assertTrue
is_runningr   s   & r   r   "TestInterpreterIsRunning.test_main  s#    $$&)*rA   Fails on FreeBSDc                H   \         P                  ! 4       pV P                  VP                  4       4       \	        V4      ;_uu_ 4        V P                  VP                  4       4       R R R 4       V P                  VP                  4       4       R #   + '       g   i     L1; irE   )r	   rY   assertFalser,  r   r+  r`   s   & r   r   ,TestInterpreterIsRunning.test_subinterpreter  sl    $$&**,-fOOF--/0 **,- s    BB!	c                
   V P                  4       w  r\        P                  ! 4       pVP                  R V R24       V P	                  VP                  4       4       V P                  \        P                  ! V^4      R4       R# )4if True:
            import os
            os.write(z, b'x')
               xN)	piper	   rY   r%   r0  r,  rJ   osread)rK   rwra   s   &   r   test_finished&TestInterpreterIsRunning.test_finished  sp    yy{$$& S  	 	**,-A-rA   c                    \         P                  ! 4       p\        V\        R VP                   R24      4      pV P                  VP                  4       R4       R# )zJ
            import _interpreters
            if _interpreters.is_running(zZ):
                print(True)
            else:
                print(False)
            TrueN)r	   rY   r   r   r   rJ   strip)rK   ra   rx   s   &  r   test_from_subinterpreter1TestInterpreterIsRunning.test_from_subinterpreter  sS    $$&&& .))/ 4* #  	f-rA   c                    \         P                  ! 4       pVP                  4        V P                  \        4      ;_uu_ 4        VP                  4        R R R 4       R #   + '       g   i     R # ; irE   )r	   rY   r   r^   r   r,  r`   s   & r   test_already_destroyed/TestInterpreterIsRunning.test_already_destroyed  sF    $$&788 9888   AA/	c                   V P                  4       w  rV P                  4       w  r4R pRp\        P                  ! 4       pVP                  RV RV: RV RV: R2	4       V P	                  VP                  4       4       \        P                  ! WE4       VP                  R4       V P                  \        P                  ! V^4      V4       R# )	   D   Fqif True:
            import os
            import threading

            def task():
                v = os.read(!, 1)
                assert v == 
                os.write(, R)
            t = threading.Thread(target=task)
            t.start()
            t.join()N)
r5  r	   rY   r%   r0  r,  r6  writerJ   r7  )rK   r_interpw_interpr_threadw_threadDONEFINISHEDra   s   &       r   !test_with_only_background_threads:TestInterpreterIsRunning.test_with_only_background_threads  s    !YY[!YY[$$& 
 &J '!H %"2h\ 2
 
	 	**,-
 J1-x8rA   c                v  a  \        R \        P                   R24      pV 3R lpS P                  R4      ;_uu_ 4        S P	                  4       ;_uu_ 4       pS P                  W1RR7      pRRR4       V! X4      pS P                  V4       RRR4       S P                  R4      ;_uu_ 4        S P                  V4      pV! V4      pS P                  V4       RRR4       S P                  R4      ;_uu_ 4        S P                  4       ;_uu_ 4       w  rcVP                  4       pS P                  VRR7      ;_uu_ 4        VP                  4       pRRR4       VP                  4       p	RRR4       S P                  X4       S P                  X4       S P                  X	4       RRR4       S P                  R	4      ;_uu_ 4        S P                  4       ;_uu_ 4       w  rcVP                  4       pS P                  VR
R7      ;_uu_ 4        VP                  4       pRRR4       VP                  4       p	RRR4       S P                  X4       S P                  X4       S P                  X	4       RRR4       S P                  R4      ;_uu_ 4        S P                  4       ;_uu_ 4       w  rjVP                  4       pRRR4       S P                  X4       RRR4       R#   + '       g   i     EL~; i  + '       g   i     ELq; i  + '       g   i     EL9; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELD; i  + '       g   i     EL@; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)r   zt as interpreters
            interp = interpreters.get_current()
            print(interp.is_running())
            c                    < SP                  V R 4        \        V 4      #   \         d    \        \        T 4      4      hi ; i)r   )r   r   r   r   )r   rK   s   &r   parse_resultsFTestInterpreterIsRunning.test_created_with_capi.<locals>.parse_results  s@    b),Dz! ,T
++,s	   
   A running __main__ (from self)Trw   N%running, but not __main__ (from self)running __main__ (from other)&running, but not __main__ (from other)Fnot running (from other))r   r	   r-   r   interpreter_from_capirun_from_capir+  r   r0  interpreter_obj_from_capir,  running_from_capi)rK   r(   rY  r   r   runningra   r   duringafterr?   s   f          r   r   /TestInterpreterIsRunning.test_created_with_capi  s     ))* + 
	, \\899++--))()F .#D)GOOG$	 : \\ABB**62D#D)GW% C
 \\9:://115Gf**,++H4+@@#..0F A))+	 2
 V$OOF#U# ; \\BCC//115Gf**,++H5+AA#..0F B))+	 2
 V$V$U# D \\455//11[f ++- 2W% 65= .-- :99 CBB A@@ 211 ;:: BAA 211 DCC 21 655s   K4K 	+!K4-+L9M.L0	 LL0	);MN .M,	MM,	5;N N'*N	=N' K1+	K44L	L	L-'	L0	0M;	MM	M)#	M,	,M=7	N  N	N$N''N8	rP   N)r-   r/   r.   rQ   r   unittestskipr   r:  r?  rB  rU  r   rR   rS   rT   s   @r   r)  r)    sF     +
 ]]%&. '..	. 92/& /&rA   r)  c                      a  ] tR tRt o R tR tR tR tR tR t	R t
]P                  ! R	4      R
 4       tR tR tRtV tR# )TestInterpreterClosei  c                   \         P                  ! 4       p\         P                  ! 4       p\         P                  ! 4       p\         P                  ! 4       pV P                  \	        \         P
                  ! 4       4      WW404       VP                  4        V P                  \	        \         P
                  ! 4       4      WV04       R # rE   )r	   r   rY   rJ   r   r]   r   )rK   rw   r   ry   r   s   &    r   
test_basicTestInterpreterClose.test_basic  s    $$&%%'%%'%%'\2245:	<\22451	3rA   c                   \        \        P                  ! 4       4      p\        4       p\        ^4       F)  p\        P                  ! 4       pVP                  V4       K+  	  V P                  \        \        P                  ! 4       4      W,          4       V F  pVP                  4        K  	  V P                  \        \        P                  ! 4       4      V4       R# r}   )r   r	   r]   r   rY   addrJ   r   )rK   r   r   r?   ra   s   &    r   test_allTestInterpreterClose.test_all)  s    \**,-%qA!((*FKK  	\2245v7GHFLLN \2245v>rA   c                F  a a \         P                  ! 4       w  oS P                  \        4      ;_uu_ 4        SP	                  4        R R R 4       VV 3R lp\
        P                  ! VR7      pVP                  4        VP                  4        R #   + '       g   i     LP; i)Nc                     < SP                  \        4      ;_uu_ 4        S P                  4        R R R 4       R #   + '       g   i     R # ; irE   )r^   r   r   )rw   rK   s   r   ri   )TestInterpreterClose.test_main.<locals>.f9  s-    ""#344

 5444s	   :A	rk   )	r	   r]   r^   r   r   rm   ro   rp   rq   )rK   ri   rr   rw   s   f  @r   r   TestInterpreterClose.test_main4  se    %%'/00JJL 1	 A&			 10s   BB 	c                    \         P                  ! 4       pVP                  4        V P                  \        4      ;_uu_ 4        VP                  4        R R R 4       R #   + '       g   i     R # ; irE   )r	   rY   r   r^   r   r`   s   & r   rB  +TestInterpreterClose.test_already_destroyedA  sC    $$&788LLN 9888rD  c                B   \         P                  ! 4       w  p\         P                  ! 4       p\        V\	        R VP
                   R24      4      pV P                  VP                  4       R4       V P                  \        \         P                  ! 4       4      W04       R# )z_
            from concurrent import interpreters
            interp = interpreters.Interpreter(z)
            try:
                interp.close()
            except interpreters.InterpreterError:
                print('failed')
            failedN)	r	   r]   rY   r   r   r   rJ   r>  r   )rK   rw   ra   rx   s   &   r   test_from_current&TestInterpreterClose.test_from_currentG  s    %%'$$&&& .//5yyk :* #  	h/\2245~FrA   c                   \         P                  ! 4       w  p\         P                  ! 4       p\         P                  ! 4       pV P                  \	        \         P                  ! 4       4      WV04       VP                  \        R VP                   R24      4       V P                  \	        \         P                  ! 4       4      W04       R# )z`
            from concurrent import interpreters
            interp2 = interpreters.Interpreter(zr)
            interp2.close()
            interp3 = interpreters.create()
            interp3.close()
            N)r	   r]   rY   rJ   r   r%   r   r   )rK   rw   r   ry   s   &   r   test_from_sibling&TestInterpreterClose.test_from_siblingU  s    %%'%%'%%'\22451	3V !007

| <  	 	\2245GrA   c                   a \         P                  ! 4       oV3R  lp\        P                  ! VR7      pVP	                  4        VP                  4        R# )c                  (   < S P                  4        R # rE   )r   )ra   s   r   ri   6TestInterpreterClose.test_from_other_thread.<locals>.ff  s    LLNrA   rk   N)r	   rY   rm   ro   rp   rq   )rK   ri   rr   ra   s   &  @r   test_from_other_thread+TestInterpreterClose.test_from_other_threadd  s:    $$&	 A&			rA   r.  c           	        \         P                  ! 4       w  p\         P                  ! 4       p\        V4      ;_uu_ 4        V P	                  \
        4      ;_uu_ 4        VP                  4        R R R 4       V P                  VP                  4       4       R R R 4       R #   + '       g   i     L9; i  + '       g   i     R # ; irE   )	r	   r]   rY   r   r^   r   r   r+  r,  r   s   &  r   test_still_running'TestInterpreterClose.test_still_runningn  s{    %%'$$&f""#344 5OOF--/0 44 s$    B3B 	/'B3 B0+B33C	c                   V P                  4       w  rV P                  4       w  r4R p\        P                  ! 4       pVP                  RV RV: R24       VP	                  4        V P                  \        P                  ! V^4      V4       R# )rG  a  if True:
            import os
            import threading
            import time

            done = False

            def notify_fini():
                global done
                done = True
                t.join()
            threading._register_atexit(notify_fini)

            def task():
                while not done:
                    time.sleep(0.1)
                os.write(rK  rL  N)r5  r	   rY   r%   r   rJ   r6  r7  )rK   rO  rP  rQ  rR  rT  ra   s   &      r   test_subthreads_still_running2TestInterpreterClose.test_subthreads_still_runningw  s    !YY[!YY[$$&   #2h\ 2! 	( 	1-x8rA   c                   \        R \        P                   R24      pV P                  R4      ;_uu_ 4        V P	                  4       ;_uu_ 4       pV P                  \        R4      ;_uu_ 4        V P                  W!RR7       RRR4       RRR4       RRR4       V P                  R4      ;_uu_ 4        V P                  \        R4      ;_uu_ 4        V P                  V4       RRR4       RRR4       V P                  R4      ;_uu_ 4        V P                  4       ;_uu_ 4       w  r2V P                  VRR7      ;_uu_ 4        V P                  \        R	4      ;_uu_ 4        VP                  4        RRR4       V P                  V P                  V4      4       RRR4       RRR4       RRR4       V P                  R
4      ;_uu_ 4        V P                  4       ;_uu_ 4       w  r2V P                  VRR7      ;_uu_ 4        V P                  \        R	4      ;_uu_ 4        VP                  4        RRR4       V P                  V P                  V4      4       RRR4       RRR4       RRR4       V P                  R4      ;_uu_ 4        V P                  4       ;_uu_ 4       w  r2V P                  \        R	4      ;_uu_ 4        VP                  4        RRR4       V P                  V P                  V4      4       RRR4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELs; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELG; i  + '       g   i     EL3; i  + '       g   i     R# ; i)r   zh as interpreters
            interp = interpreters.get_current()
            interp.close()
            r[  zInterpreterError.*unrecognizedTr\  Nr]  r^  unrecognizedr_  Fr`  )r   r	   r-   r   ra  assertRaisesRegexr   rb  r   rc  rd  r   r   r+  interp_exists)rK   r(   r   ra   s   &   r   r   +TestInterpreterClose.test_created_with_capi  s)     ))* +  \\899++--++O,LN N&&xd&CN . : \\ABB''(HJ J''/J C
 \\9:://115Gf++H4+@@//0@.QQ R OO**846	 A 2 ; \\BCC//115Gf++H5+AA//0@.QQ R OO**846	 B 2 D \\455//115Gf++,<nMMLLN N&&x02 2 65?N N N .-- :99J J J CBB RQQ A@@ 211 ;::  RQQ BAA 211 DCC NMM 211 655sC  L;L'	/LL'	L;4M#M	%M#N3'N	N$M75(NN	%N3P'O/	O$O5(OO/	%PP?'!P+	P(P+	P?L$	L'	'L82	L;;M	M 	M##M4	7N	NN	N	N0*	N33O	O	OO,&	O/	/P :	PP	P("	P+	+P<6	P??Q	rP   N)r-   r/   r.   rQ   rn  rr  r   rB  r|  r  r  ri  rj  r  r  r   rR   rS   rT   s   @r   rl  rl    sW     	3	?GH ]]%&1 '19>-2 -2rA   rl  c                   Z   a  ] tR tRt o R tR tR tR tR tR t	R t
]R	 4       tR
tV tR# )TestInterpreterPrepareMaini  c                    \         P                  ! 4       pV P                  \        4      ;_uu_ 4        VP	                  4        R R R 4       R #   + '       g   i     R # ; irE   )r	   rY   r^   r  prepare_mainr`   s   & r   
test_empty%TestInterpreterPrepareMain.test_empty  s<    $$&z**! +***s   AA	c                    R ^*RR/p\         P                  ! 4       pVP                  V4       \        V\	        R4      4      pV P                  VP                  4       R4       R# spameggsham+
            print(spam, eggs)
            42 hamNr	   rY   r  r   r   rJ   r>  rK   valuesra   rx   s   &   r   	test_dict$TestInterpreterPrepareMain.test_dict  s\    "fe,$$&F#&& * #  	h/rA   c                    R ^*RR/p\        VP                  4       4      p\        P                  ! 4       pVP	                  V4       \        V\        R4      4      pV P                  VP                  4       R4       R# r  )	tupleitemsr	   rY   r  r   r   rJ   r>  r  s   &   r   
test_tuple%TestInterpreterPrepareMain.test_tuple  sl    "fe,v||~&$$&F#&& * #  	h/rA   c                    R ^*RR/p\         P                  ! 4       pVP                  ! R/ VB  \        V\	        R4      4      pV P                  VP                  4       R4       R# )r  r  r  r  r  NrP   r  r  s   &   r   test_kwargs&TestInterpreterPrepareMain.test_kwargs  s_    "fe,$$&%f%&& * #  	h/rA   c                    R ^*RR/p\         P                  ! 4       pVP                  VRR7       \        V\	        R4      4      pV P                  VP                  4       R4       R# )r  r  r  bar)fooz0
            print(spam, eggs, foo)
            z
42 ham barNr  r  s   &   r   test_dict_and_kwargs/TestInterpreterPrepareMain.test_dict_and_kwargs  sa    "fe,$$&F.&& * #  	l3rA   c                   \         P                  ! 4       pV P                  \         P                  4      ;_uu_ 4        VP	                  R RRR/R7       RRR4       V P                  \
        4      ;_uu_ 4        VP                  R4       RRR4       V P                  \
        4      ;_uu_ 4        VP                  R4       RRR4       R#   + '       g   i     L; i  + '       g   i     L\; i  + '       g   i     R# ; i)r  r  r  r  r  Nz
print(foo)zprint(spam))r	   rY   r^   NotShareableErrorr  r   r%   r`   s   & r   test_not_shareable-TestInterpreterPrepareMain.test_not_shareable  s    $$&|==>>ffeU%CD ? //KK% 0//KK& 0/ ?> 0////s#   C9C0C2C	C/	2D	c           	     |   \         P                  ! 4       pVP                  R R/4       V P                  V4      ;_uu_ 4        V P	                  \
        R4      ;_uu_ 4        VP                  R R/4       RRR4       RRR4       VP                  R4       R#   + '       g   i     L+; i  + '       g   i     L6; i)r  Tre  FNassert spam is True)r	   rY   r  re  r  r   r%   r`   s   & r   test_running'TestInterpreterPrepareMain.test_running  s    $$&VTN+\\&!!''(8)DD##VUO4 E " 	)* ED "!s$   B+!B	5B+B(#B++B;	c           	        V P                  4       ;_uu_ 4       w  rV P                  \        R 4      ;_uu_ 4        VP                  RR/4       RRR4       V P                  \        R4      ;_uu_ 4        V P                  VR4       RRR4       RRR4       R#   + '       g   i     LS; i  + '       g   i     L-; i  + '       g   i     R# ; i)r  r  TN	NameErrorr  )rc  r  r   r  r   rb  )rK   ra   r   s   &  r   r   1TestInterpreterPrepareMain.test_created_with_capi  s    ++--1C&''(8.II##VTN3 J''EE""8-BC F .-IIEE .--s:   !B?B	&B?4B,	B?B)$B?,B<7B??C	rP   N)r-   r/   r.   rQ   r  r  r  r  r  r  r  r   r   rR   rS   rT   s   @r   r  r    s>     "
0004	'+ D DrA   r  c                      a  ] tR tRt o R tR t]R 4       tR t]	P                  ! 4       R 4       t]P                  ! R4      R 4       tR	 tR
 tR tR tR tRtV tR# )TestInterpreterExeci  c                4   \         P                  ! 4       p\        R 4      w  r#V;_uu_ 4        VP                  V4       RRR4       VP	                  4       pVP                  4        VP                  pV P                  VR4       R#   + '       g   i     LP; i)print("it worked!", end="")N
it worked!)r	   rY   r   r%   finalraise_if_failedstdoutrJ   )rK   ra   r(   resultsrx   s   &    r   test_success TestInterpreterExec.test_success  sk    $$&*+HIWKK --/!nnl+ Ws   BB	c                    \         P                  ! 4       pV P                  \        4      ;_uu_ 4        VP	                  R 4       RRR4       R#   + '       g   i     R# ; i)zraise ExceptionN)r	   rY   r^   r   r%   r`   s   & r   test_failure TestInterpreterExec.test_failure  s=    $$&//KK)* 0///   AA 	c                r   V P                  4       pV P                  R VRR7      pV P                  RVRR7      pV P                  V4      w  rERV n        R VP                  4        4       w  pV P                  V\        RV RVP                  4        R	V R
V RV R24      4       V P                  VR4       R# )r  z
            def ham():
                raise RuntimeError('uh-oh!')

            def eggs():
                ham()
            )r   z	script.pyz
            from concurrent import interpreters

            def script():
                import spam
                spam.eggs()

            interp = interpreters.create()
            interp.exec(script)
            Nc              3   8   "   T F  pR V9   g   K  Vx  K  	  R# 5i)z execNrP   )r   ls   & r   r   GTestInterpreterExec.test_display_preserved_exception.<locals>.<genexpr>7  s     J&9W\11&9s   	
zC            Traceback (most recent call last):
              File "zm", line 9, in <module>
                interp.exec(script)
                ~~~~~~~~~~~^^^^^^^^
              z
                raise ExecutionFailed(excinfo)
            concurrent.interpreters.ExecutionFailed: RuntimeError: uh-oh!

            Uncaught in the interpreter:

            Traceback (most recent call last):
              File "za", line 6, in script
                spam.eggs()
                ~~~~~~~~~^^
              File "zS", line 6, in eggs
                ham()
                ~~~^^
              File "zl", line 3, in ham
                raise RuntimeError('uh-oh!')
            RuntimeError: uh-oh!
            r   )	temp_dirmake_modulemake_scriptassert_python_failuremaxDiffr   rJ   r   r>  )rK   tempdirmodfile
scriptfiler  stderrinterpmod_lines   &      r    test_display_preserved_exception4TestInterpreterExec.test_display_preserved_exception   s    --/""67 :"  %%k7 	B% 	
 33J?Jf&7&7&9J -L ! ##%& '  L ! I  I %) " 	, 	$rA   c                  aa \         P                  ! 4       o\        R 4      w  opV;_uu_ 4        VV3R lp\        P                  ! VR7      pVP                  4        VP                  4        RRR4       VP                  4       pVP                  4        VP                  pV P                  VR4       R#   + '       g   i     LP; i)r  c                  *   < S P                  S4       R # rE   )r%   )ra   r(   s   r   ri   -TestInterpreterExec.test_in_thread.<locals>.fU  s    F#rA   rk   Nr  )r	   rY   r   rm   ro   rp   rq   r  r  r  rJ   )rK   r  ri   rr   rx   ra   r(   s   &    @@r   rs   "TestInterpreterExec.test_in_threadQ  s    $$&*+HIW$   *AGGIFFH  --/!nnl+ Ws   ?B77C	c           	        \         P                  ! 4       p^ RIpVP                  RRR7      ;_uu_ 4       pVP	                  R4       VP                  4        Rp\        RVP                   RV R	24      pVP                  V4       VP                  ^ 4       VP                  4       pV P                  Wd4       RRR4       R#   + '       g   i     R# ; i)
r   Nzw+utf-8)encodingr   zspam spam spam spam spamz
                import os
                try:
                    os.fork()
                except RuntimeError:
                    with open('zE', 'w', encoding='utf-8') as out:
                        out.write('z')
                )r	   rY   tempfileNamedTemporaryFilerN  flushr   r'   r%   seekr7  rJ   )rK   ra   r  filer   r(   contents   &      r   	test_forkTestInterpreterExec.test_forka  s    $$&(((@@DJJrNJJL1H ! 
 !%		{ +$$,: . F KKIIaLiikGW/# A@@@s   BCC	r.  c           	     $   \         P                  ! 4       p\        V4      ;_uu_ 4        V P                  \        4      ;_uu_ 4        VP                  R 4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)zprint("spam")N)r	   rY   r   r^   RuntimeErrorr%   r`   s   & r   test_already_running(TestInterpreterExec.test_already_runningy  sX    $$&f""<00O, 1 00 s#   A>A+	A>+A;6A>>B	c                    \         P                  ! 4       pV P                  \        4      ;_uu_ 4        VP	                  ^
4       RRR4       R#   + '       g   i     R# ; i)
   N)r	   rY   r^   r   r%   r`   s   & r   test_bad_script#TestInterpreterExec.test_bad_script  s;    $$&y))KKO *)))r  c                   V P                  4       w  rR pRp\        P                  ! 4       pVP                  RV RV: R24       \        P
                  ! W$4       V P                  \        P                  ! V^4      V4       R# )   RrF  r3  rK  )
            Nr5  r	   rY   r%   r6  rN  rJ   r7  )rK   r8  r9  RANrS  ra   s   &     r   test_bytes_for_script)TestInterpreterExec.test_bytes_for_script  su    yy{$$& S3' " 	 	A,rA   c                <   V P                  4       w  rV P                  4       w  r4R pRpRp\        P                  ! 4       pVP                  RV RV: RV RV: RV RV: R24       VP                  R	V RV: R24       \        P
                  ! WF4       VP                  R
4       V P                  \        P                  ! V^4      V4       V P                  \        P                  ! V^4      V4       V P                  \        P                  ! V^4      V4       R# )r  rF  rG  rH  rI  rJ  rK  z[)
            t = threading.Thread(target=task)
            t.start()
            os.write(r  zif True:
            os.write(rM  Nr  )	rK   rO  rP  rQ  rR  r  rS  rT  ra   s	   &        r   *test_with_background_threads_still_running>TestInterpreterExec.test_with_background_threads_still_running  s   !YY[!YY[$$& 
 &J '!H %"2h\ 2 Zr# ) 	 	 Zr# ) 	 	 J1-s31-s31-x8rA   c           	     
   V P                  4       ;_uu_ 4       w  rV P                  \        R 4      ;_uu_ 4        VP                  R4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  raise Exception("it worked!")N)rc  r  r   r%   )rK   ra   r?   s   &  r   r   *TestInterpreterExec.test_created_with_capi  sW    ++--&''(8.II;< J .-II .--s"   !A1A	A1A.)A11B	c                $   ^ RI pV P                  4       w  r#\        P                  ! 4       pVP	                  RV R24       V P                  \        P                  ! V^
4      P                  4       VP                  4       VP                  4        R# )r   Nzcif True:
            import os
            comp = [str(i) for i in range(10)]
            os.write(z", ''.join(comp).encode())
        )stringr5  r	   rY   r%   rJ   r6  r7  decodedigitsr   )rK   r   rO  rP  ra   s   &    r   test_list_comprehension+TestInterpreterExec.test_list_comprehension  sx     	!YY[$$&  Z  	 	
 	2.557GrA   )r  N)r-   r/   r.   rQ   r  r  r   r  rs   r   requires_forkr  ri  rj  r  r  r  r  r   r  rR   rS   rT   s   @r   r  r    s     	,+
 .% .%`,  0 0. ]]%&- '-

-9>=
 rA   r  c                      R# )r   r   rP   rP   rA   r   call_func_return_shareabler    s    rA   c                      R  # )c                     V # rE   rP   xs   &r   <lambda>1call_func_return_stateless_func.<locals>.<lambda>  s    arA   rP   rP   rA   r   call_func_return_stateless_funcr    s    rA   c                  
    . RO# )r   r      r~   rP   rP   rA   r   call_func_return_pickleabler    s    rA   c                     a  ^*o V 3R l# )*   c                     < S # rE   rP   r
  s   r   r  /call_func_return_unpickleable.<locals>.<lambda>  s    ArA   rP   r
  s   @r   call_func_return_unpickleabler    s    
ArA   c                    a  V 3R  lpV# )c                     < S # rE   rP   r  s   r   call_func_closure0get_call_func_closure.<locals>.call_func_closure  s    rA   rP   )r  r  s   f r   get_call_func_closurer    s    rA   c                 4    \        WV4      pW!\        V4      3# rE   )r%   r   )r(   nsr   s   && r   call_func_exec_wrapperr     s    
v2
CBrF?rA   c                   X   a  ] tR tRt o ]R 4       t]R 4       tR tR t	R t
R tRtV tR	# )
Spami  c                     R # rE   rP   rP   rA   r   noop	Spam.noop  s    rA   c                    V ! V4      # rE   rP   )clsr  s   &*r   from_valuesSpam.from_values  s    6{rA   c                    Wn         R # rE   r  )rK   r  s   &&r   __init__Spam.__init__  s    
rA   c                    V P                   W3# rE   r  rK   argskwargss   &*,r   __call__Spam.__call__      

D))rA   c                l    \        V\        4      '       g   \        # V P                  VP                  8H  # rE   )r5   r"  NotImplementedr  )rK   others   &&r   __eq__Spam.__eq__  s(    %&&!!zzU[[((rA   c                    V P                   W3# rE   r  r.  s   &*,r   runSpam.run  r3  rA   r  N)r-   r/   r.   rQ   staticmethodr$  classmethodr(  r+  r1  r7  r:  rR   rS   rT   s   @r   r"  r"    sD        *)
* *rA   r"  excc                   Ve   VhV R8X  d   \        R4      hV R8X  d   V'       g	   V'       d   \        W434      hV# V R8X  d   WV3# V R8X  d(   Vf   V'       g	   V'       d   \        WV34      h\        # V R8X  dA   Vf   V'       g	   V'       d   \        WV34      h\        P                  ! 4       P
                  # V R8X  d(   V'       g	   V'       d   \        W434      h\        V4      # V R8X  d(   V'       g	   V'       d   \        W434      h\        V4      # V R	8X  d4   V'       g	   V'       d   \        W434      h ! R
 R\        4      pV! V4      # \        V \        4      '       g   \        V 4      h\        V 4      h)Nr   z
missing opident
full-identglobalsr   closurecustomcustom-innerc                       ] tR tRtRtR# )call_func_complex.<locals>.Eggsi!  rP   N)r-   r/   r.   rQ   rR   rP   rA   r   EggsrG  !  s    rA   rH  )r  r   r-   r	   r   r   r  r"  r5   r:   r   NotImplementedError)opr  r>  r/  r0  rH  s   "&$*, r   call_func_complexrK    sE   
		Rx&&	w6TN++	|	V$$	yU&122	z	U&122''),,,	y6TN++$U++	x6TN++E{	~	6TN++	4 	E{C  m!"%%rA   c                      a  ] tR tRt o ]P
                  R 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 tRtV tR# )TestInterpreterCalli*  c              #    "   V P                  \        4      ;_uu_ 4       pVx  R R R 4       XP                  P                  pV P	                  VP
                  P                  VP                  4       R #   + '       g   i     LX; i5irE   )r^   r   	exceptionexcinforJ   r1   r-   )rK   r   cmuncaughts   &&  r   assert_fails TestInterpreterCall.assert_failsJ  sY     //2H 0<<''//1B1BC 0/s   BA5AB5B	 Bc                @    V P                  \        P                  4      # rE   )rS  r	   r  r  s   &r   assert_fails_not_shareable.TestInterpreterCall.assert_fails_not_shareableQ  s      !?!?@@rA   c                   W8X  d   R # V P                  VP                  VP                  4       V P                  VP                  VP                  4       V P                  VP                  VP                  4       V P                  VP                  VP                  4       V P                  VP
                  VP
                  4       V P                  VP                  VP                  4       V P                  VP                  VP                  4       V P                  \        P                  ! V4      \        P                  ! V4      4       V P                  VP                  VP                  4       R # rE   )rJ   co_nameco_flags	co_constsco_varnamesco_cellvarsco_freevarsco_namesr   get_code_var_countsco_code)rK   code1code2s   &&&r   assert_code_equal%TestInterpreterCall.assert_code_equalT  s   >68%//:**E,=,=>**E,=,=>**E,=,=>811%811%8	
 	6rA   c                N   W8X  d   R # V P                  \        V4      \        V4      4       V P                  VP                  VP                  4       V P                  VP                  VP                  4       V P                  VP
                  VP
                  4       V P                  VP                  VP                  4       V P                  VP                  VP                  4       V P                  \        P                  ! V4      \        P                  ! V4      4       R # rE   )r   r1   rJ   r-   __defaults____kwdefaults____closure__rd  __code__r   r`  )rK   func1func2s   &&&r   assert_funcs_equal&TestInterpreterCall.assert_funcs_equald  s    >d5k4;/8++U-?-?@--u/C/CD**E,=,=>u~~u~~>11%811%8	
rA   c                
   \        V\        4      '       g   Q h\        V\        4      '       g   Q hW8X  d   R # V P                  \        V4      \        V4      4       V P	                  VP
                  VP
                  4       R # rE   )r5   r   r   r1   rJ   r/  )rK   exc1exc2s   &&&r   assert_exceptions_equal+TestInterpreterCall.assert_exceptions_equalr  s^    $	****$	****<d4j$t*-DII.rA   c           	     J   \         P                  ! 4       p\        pV P                  R 4      ;_uu_ 4        VP	                  V4      pV P                  V4       RRR4       \        pV P                  R4      ;_uu_ 4        VP	                  V4      pV P                  VR4       RRR4       \        pR pV P                  R4      ;_uu_ 4        VP	                  V4      pV P                  W44       RRR4       \        pV P                  R4      ;_uu_ 4        VP	                  V4      pV P                  V. RO4       RRR4       \        pV P                  R4      ;_uu_ 4        V P                  \         P                  4      ;_uu_ 4        VP	                  V4       RRR4       RRR4       R#   + '       g   i     ELa; i  + '       g   i     EL*; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lh; i  + '       g   i     R# ; i)	zno args, no returnNzno args, returns shareablec                     V # rE   rP   r
  s   &r   r  :TestInterpreterCall.test_stateless_funcs.<locals>.<lambda>  s    arA   zno args, returns stateless funczno args, returns pickleablezno args, returns unpickleabler   r  )r	   rY   call_func_noopr   callassertIsNoner  rJ   r  rm  r  r  r^   r  )rK   ra   funcr   r   s   &    r   test_stateless_funcs(TestInterpreterCall.test_stateless_funcsz  s   $$&\\.//++d#Cc" 0 *\\677++d#CS), 8 /\\;<<++d#C##C2 = +\\788++d#CS), 9 -\\9::""<#A#ABBD! C ;:+ 0//
 877 =<
 98 CB ;::sS   #F0?$G#G&G+$(HG>	H0G	G	G(	+G;	>H	HH"	c                   \         P                  ! 4       pR ^
RRR\        R4      3 Fw  pV P                  RV: 24      ;_uu_ 4        \        P                  V4      '       g   Q hVP                  \        P                  V4      pV P                  W24       R R R 4       Ky  	  \        P                   FZ  pV P                  RV: 24      ;_uu_ 4        VP                  \        P                  V4      pV P                  W24       R R R 4       K\  	  \        P                   F  pV\        P                  9   d   K  V P                  RV: 24      ;_uu_ 4        VP                  \        P                  V4      pV P                  W24       \        V4      '       g   Q h R R R 4       K  	  \        \        \!        4       ^R,          . ROR^R^/\"        P$                  ! ^*R	7      \         \&        \(        \*        \)        R
4      \+        R4      \,        \.        P0                  .\        P2                  OR \        P2                  P5                  4        4       O F  pV P                  RV: 24      ;_uu_ 4        VP                  \        P                  V4      p\'        V4      \         J d!   V P7                  \'        V4      \         4       M9\9        V\:        4      '       d   V P=                  W24       MV P                  W24       \        V4      '       g   Q h R R R 4       K  	  \"        P>                  ! / 4      .R \        P@                   4       O F  pV P                  RV: 24      ;_uu_ 4        \        P                  V4      '       d   Q h\        V4      '       d   Q hV PC                  \         PD                  4      ;_uu_ 4        VP                  \        P                  V4       R R R 4       R R R 4       K  	  R #   + '       g   i     EK  ; i  + '       g   i     EKt  ; i  + '       g   i     EK  ; i  + '       g   i     EK  ; i  + '       g   i     Lr; i  + '       g   i     EK(  ; i)Nspam!s   spam!z
shareable zstateless func zstateful func i  abr
  uh-oh!mymodulec              3   `   "   T F$  w  rV\         P                  9  g   K  V! V!  x  K&  	  R # 5irE   )defsCLASSES_WITHOUT_EQUALITY)r   cr  s   &  r   r   FTestInterpreterCall.test_stateless_func_returns_arg.<locals>.<genexpr>  s-      9 8$777 ae 8s   ..zpickleable c              3   T   "   T F  pV\         P                  9  g   K  Vx  K   	  R # 5irE   )r  STATELESS_FUNCTIONS)r   ri   s   & r   r   r    s'      4.A$222 a.s   (
(zunpickleable )r   r  r~  r  )#r	   rY   
memoryviewr   r   is_shareablerx  r  spam_returns_argrJ   r  rm  TOP_FUNCTIONSr   Ellipsisr5  r   r8   r9   r1   r   ModuleNotFoundErrorr   sysexitTOP_CLASSESr  r   r5   r7   rr  MappingProxyTypeNESTED_FUNCTIONSr^   r  )rK   ra   argr   s   &   r   test_stateless_func_returns_arg3TestInterpreterCall.test_stateless_func_returns_arg  so   $$& x 
C 
3'233$11#6666kk$"7"7=  * 43
 ++Cw788kk$"7"7=''1 98 ,
 %%Cd...sg677kk$"7"7=''1$S)))) 87 & HtG!S!!!B'h
+HH%
( )
*9 0 0 6 6 8 9+
C0 C7344kk$"7"7=9&MM$s)V4]3300:$$S.$S)))) 541
F ""2&
4.. 4
C
 cW566(55c::::(----&&|'E'EFFKK 5 5s; G 76
i 433 988 877: 544$ GF 766sX   AO?2PAP)5B P>0AQ&!Q)Q&?PP&)P;>QQ#Q&&Q8c                    \         P                  ! 4       p^^^^^^RR^R^/3p\        P                  pVP	                  V^^^^R^^^^R7
      pV P                  WB4       R# )r   ?gheri   r  r  N)r  )r	   rY   r  spam_full_argsrx  rJ   )rK   ra   r   rz  r   s   &    r   test_full_args"TestInterpreterCall.test_full_args  sj    $$&q!Q1fsAsA.>?""kk$1aC1Q!kD'rA   c                    \         P                  ! 4       pRRRRR	R
RR^R^	/3pVP                  \        P                  ^^	R7      pV P                  W24       R# )r   r  r  )r  r  Nr  r   irP   )r	   rY   rx  r  spam_full_args_with_defaultsrJ   )rK   ra   r   r   s   &   r   test_full_defaults&TestInterpreterCall.test_full_defaults  sW    $$&BBBaa0@Akk$;;qAkF'rA   c                j   \         P                  ! 4       p\        R 4      p/ pR^R^R^1/pVP                  \        W#4      pVw  rgpVR V P                  V4       V P                  V/ 4       V P                  Wt4       V P                  V\        V4      4       V P                  V\        V4      4       R# )zH
            a = 7
            b = 2
            c = a ** b
            r  r  r  r<   N)	r	   rY   r   rx  r   ry  rJ   r   r   )	rK   ra   r(   r  r   r   r   resnsresids	   &        r   test_modified_arg%TestInterpreterCall.test_modified_arg  s    $$&  
 CC,kk0&=E.!#R )E2b6*E2e9-rA   c           	       a \         P                  ! 4       ;_uu_ 4       oV3R  lpV3R lpV P                  R4      ;_uu_ 4        V! R4      pV P                  VR4       RRR4       V! RR4       V P                  R4      ;_uu_ 4        V! R	4      pV P                  VR4       RRR4       V! RR
4       V P                  R4      ;_uu_ 4        V! R4      pV P                  VR4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     Lr; i  + '       g   i     L@; i  + '       g   i     R# ; i)c                 J   < \         P                  ! SV \        V4      4       R # rE   )r   r  r   )r'   r   r  s   &&r   new_mod@TestInterpreterCall.test_func_in___main___valid.<locals>.new_mod  s    ))'4FrA   c                    < R p\        RS: R24      \        V 4      ,           p \        P                  ! SW4      p\        P                  ! V4      pVP                  P                  R4      P                  4       # )myscriptz?
                import sys
                sys.path.insert(0, z)

                r  )r   r   r  assert_python_okrx   r  r>  )r   r'   filenamer   r  s   &   r   r:  <TestInterpreterCall.test_func_in___main___valid.<locals>.run  st    ! #$$+; /  d|	$
 )44WdI#44X>ww~~g.4466rA   zno indirectiona  
                    from concurrent import interpreters

                    def spam():
                        # This a global var...
                        return __name__

                    if __name__ == '__main__':
                        interp = interpreters.create()
                        res = interp.call(spam)
                        print(res)
                    <fake __main__>Nmymodze
                def run(interp, func):
                    return interp.call(func)
                zindirect as func, direct interpa  
                    from concurrent import interpreters
                    import mymod

                    def spam():
                        # This a global var...
                        return __name__

                    if __name__ == '__main__':
                        interp = interpreters.create()
                        res = mymod.run(interp, spam)
                        print(res)
                    z
                from concurrent import interpreters
                def run(func):
                    interp = interpreters.create()
                    return interp.call(func)
                z!indirect as func, indirect interpa/  
                    import mymod

                    def spam():
                        # This a global var...
                        return __name__

                    if __name__ == '__main__':
                        res = mymod.run(spam)
                        print(res)
                    )r   r  r   rJ   )rK   r  r:  r   r  s   &   @r   test_func_in___main___valid/TestInterpreterCall.test_func_in___main___valid  s#    !!WG	7 .//      '89 0  G "  ?@@      '89 A" G "  ABB 
  
   '89 Cw "!  0/( A@. CBw "!!sS   &D5C<	 *D5
D	%*D5D"	*D5<DD5DD5"D2-D55E	c                   \         P                  ! 4       p\        P                  R R4       R2p\	        RV R24      pV P                  R4      ;_uu_ 4        \        W#4      ;_uu_ 4       pV P                  \         P                  4      ;_uu_ 4        VP                  \        P                  V4       RRR4       RRR4       RRR4       V P                  R4      ;_uu_ 4        \        W#RR	7      ;_uu_ 4       pV P                  \         P                  4      ;_uu_ 4        VP                  \        P                  V4       RRR4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L[; i  + '       g   i     Lf; i  + '       g   i     R# ; i)
.r?   
_spam_okayz
            def zW():
                # This a global var...
                return __name__
            zpickleable, added dynamicallyNzlying about __main__T)r    )r	   rY   r-   replacer   r   r+   r^   r  rx  r  r  )rK   ra   funcnamer(   r  s   &    r   test_func_in___main___invalid1TestInterpreterCall.test_func_in___main___invalidM  s>   $$&&&sC01< 
   \\9::$X66#&&|'E'EFFKK 5 5s; G 7 ;
 \\011$XdCCs&&|'E'EFFKK 5 5s; G D 21 GF 76 ;: GF DC 211sx   F+(E1	!E4E1	<F%F=;(F*	#!FF*	F=E.)E1	1F<FF	F'"F*	*F:5F==G	c           
     0   \        R 4      p\        P                  ! 4       ;_uu_ 4       p\        P                  ! VRV4      p\        P
                  ! V4      pRRR4       XP                  P                  R4      P                  4       p\        V4      w  rgVw  rVw  p
 rp pV P                  VV
RXVVRR.4       V P                  VR4       V P                  VR4       V P                  W4       Vw  rVw  p r  pV P                  VVRRVRRR.4       V	w  p ppp pV P                  V	VRVVVRR.4       V P                  VR4       V P                  VR4       V P                  VV4       V P                  VV4       R#   + '       g   i     EL5; i)aR  
            eggs = True

            def spam(*, explicit=False):
                if explicit:
                    import __main__
                    ns = __main__.__dict__
                else:
                    # For now we have to have a LOAD_GLOBAL in the
                    # function in order for globals() to actually return
                    # spam.__globals__.  Maybe it doesn't go through pickle?
                    # XXX We will fix this later.
                    spam
                    ns = globals()

                func = ns.get('spam')
                return [
                    id(ns),
                    ns.get('__name__'),
                    ns.get('__file__'),
                    id(func),
                    None if func is None else repr(func),
                    ns.get('eggs'),
                    ns.get('ham'),
                ]

            if __name__ == "__main__":
                from concurrent import interpreters
                interp = interpreters.create()

                ham = True
                print([
                    [
                        spam(explicit=True),
                        spam(),
                    ],
                    [
                        interp.call(spam, explicit=True),
                        interp.call(spam),
                    ],
                ])
           	my-scriptNr  r#   Tz^<function spam at 0x.*>$r  )r   r   r  r   r  r  rx   r  r>  r   rJ   assertIsNotassertRegexr   )rK   r   r  r  r   r  localremoterw   r%  nsidr?   funcidrz  nsid1funcid1nsid2funcid2s   &                 r   test_func_in___main___hidden0TestInterpreterCall.test_func_in___main___hiddena  s      ) )T !!W$00+tLH00:C " (..0V  )-&aD!Q 
 	 	t$:;) !(,%q!aA 
 	 ,5(q!WdAq%
 	 	t$:;E5)GW-_ "!!s   /FF	c           	        \        R 4      p\        P                  ! 4       ;_uu_ 4       p\        P                  ! VRV4      p\        P
                  ! V4      pRRR4       XP                  P                  R4      P                  4       p\        V4      w  rgrV P                  V	RRRRRR/4       V P                  V^ 4       V P                  V^ 4       V P                  V. RO4       R#   + '       g   i     L; i)	a  
            count = 0

            def inc(x=1):
                global count
                count += x

            def get_count():
                return count

            if __name__ == "__main__":
                counts = []
                results = [count, counts]

                from concurrent import interpreters
                interp = interpreters.create()

                val = interp.call(get_count)
                counts.append(val)

                interp.call(inc)
                val = interp.call(get_count)
                counts.append(val)

                interp.call(inc, 3)
                val = interp.call(get_count)
                counts.append(val)

                results.append(count)

                modified = {name: interp.call(eval, f'{name!r} in vars()')
                            for name in ('count', 'inc', 'get_count')}
                results.append(modified)

                print(results)
           r  Nr  countFinc	get_count)r   r      )r   r   r  r   r  r  rx   r  r>  r   rJ   )
rK   r   r  r  r   r  r   countsrg  modifieds
   &         r   "test_func_in___main___uses_globals6TestInterpreterCall.test_func_in___main___uses_globals  s    0  # #H !!W$00+tLH00:C " (..0*.v,'U5$
 	
 	#"+ "!s   /C))C9	c           	        \         P                  ! 4       pV P                  \        4      ;_uu_ 4        VP	                  \
        4       R R R 4       V P                  \        4      ;_uu_ 4        VP	                  \        R\        R4      R7       R R R 4       R #   + '       g   i     LY; i  + '       g   i     R # ; i)N???r  )r>  )	r	   rY   r^   r   rx  call_func_failurerS  r  rK  r`   s   & r   test_raisesTestInterpreterCall.test_raises  s{    $$&//KK)* 0 z**KK)5j6HKI +* 0/ +**s   B."B-B*	-B>	c                :   \         P                  ! 4       p\        \        R	/ R 3\        R
/ R3\
        R	/ R3\        R	/ . RO3\        P                  R	/ R 3\        P                  R	/ \        R	4      3\        P                  R/ \        R4      3\        R/ \        R4      3\        ^e4      R	/ ^eR	/ 33\        R4      P                  R	/ RR	/ 33\        R/ R3\        R/ RR	/ 33\        RRR/RRRR/33\        R/ \        3\        R/ VP                  3\        R/ \        R4      3.4       F\  w  pw  r4rVV P                  RV^,            24      ;_uu_ 4        VP                  ! V.VO5/ VB pV P!                  Wv4       R R R 4       K^  	  R #   + '       g   i     Ks  ; i)Nspamspamspamr  u'  r  r  !!!r~  success case #rP   )r  r   r  )r  r@  r  rA  r  rA  r  r  )r  rB  r   rD  r~  )r	   rY   	enumeraterw  call_func_identr  r  r"  r$  r(  r:  rK  r-   r   r   rx  rJ   )rK   ra   r   callabler/  r0  r   r   s   &       r   test_call_valid#TestInterpreterCall.test_call_valid  s   $$&5>RT*/^D'R;("b)<YYB%r2tBx0y"d9o>8Re-#YBb".%[__b"ub"o6 12v> 6VR<LM =h02b(;r699= 3RgG#@
 61A1& qse455kk(<T<V<  / 65'6& 655s   (F		Fc           
        \         P                  ! 4       p\        pV P                  V4      ;_uu_ 4        V P	                  \         P
                  4      ;_uu_ 4        VP                  V^*4       RRR4       RRR4       \        ^*4      pV P                  V4      ;_uu_ 4        V P	                  \         P
                  4      ;_uu_ 4        VP                  V4       RRR4       RRR4       \        pRpV P                  V RV R24      ;_uu_ 4        V P	                  \         P
                  4      ;_uu_ 4        VP                  W#RR7       RRR4       RRR4       RpV P                  V RV R24      ;_uu_ 4        V P	                  \         P
                  4      ;_uu_ 4        VP                  W#R4       RRR4       RRR4       R#   + '       g   i     ELh; i  + '       g   i     ELt; i  + '       g   i     EL"; i  + '       g   i     EL.; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)	r  NrC   ()z~~~r  rE  zeggs!)r	   rY   r  r   r^   r  rx  rK  )rK   ra   rz  rJ  s   &   r   test_call_invalid%TestInterpreterCall.test_call_invalid8  s   $$&$\\$""<#A#ABBD"% C   %R(\\$""<#A#ABBD! C   !\\TF"RD*++""<#A#ABBDE2 C , \\TF"RD*++""<#A#ABBDg. C ,+ CBB   CBB   CB ,+ CB ,++s   (G#G	0G#$(HG7	H(H2=H	H2(I*I	=IG 	G##G4	7H	HH	H/*H22I	III)	c           
        \         P                  ! 4       p\        R 3. RO3\        R3^3\        R3R33 FQ  w  r#V P	                  \        V4      4      ;_uu_ 4        VP                  ! V!  pV P                  WC4       RRR4       KS  	  \        \        \        .p\        \        \        \        \        \        \        \        /P                  4        F  w  rgV P	                  \        V4      4      ;_uu_ 4        We9   dC   V P                  \         P                   4      ;_uu_ 4        VP                  V4       RRR4       M4VP                  V4      pV P#                  WG4       V P%                  RV4       RRR4       K  	  R#   + '       g   i     EKb  ; i  + '       g   i     L3; i  + '       g   i     K  ; i)z	[1, 2, 3]zsum([1, 2, 3])z...Nr<   r  )r	   rY   r   r%   r   r:   rx  rJ   rB  localsr$   dictdirlistr  r^   r  rZ   r\   )rK   ra   rx  r   r   result_not_pickleablerz  expectedtypes   &       r   test_callable_requires_frame0TestInterpreterCall.test_callable_requires_frameP  sj   $$&K $%E]
ND c$i((kk4(  / )(
 !
 TD$	#

 %'#D c$i((0**<+I+IJJD) KJ !++d+C))#<MM.#6 )(# )((" KJ )((s0   "F:.F-(F:=F-FF*%F--F>c                   ^ RI Hp \        P                  ! 4       pVP	                  \
        4      pV P                  V. RO4       V Uu/ uF!  qDR8w  g   K  WBP	                  \        V4      bK#  	  ppV P                  VRRRR	RR	RR	RV/4       V P                  \        4      ;_uu_ 4        VP	                  \        R
4      3 R	R	R	4       VP	                  \        RV 24       VP                  ^*R7       VR
.,           pVP	                  \
        4      pV P                  W64       VP	                  \        R
4      pV P                  V^*4       VP	                  \        RV R24       R	# u upi   + '       g   i     L; i)r   )BuiltinImporterr<   __doc__
__loader__r-   __package____spec__r#   Nr  zassert dir() == r  z, dir())r<   r  r  r-   r  r   )_frozen_importlibr  r	   rY   rx  r  rJ   r   r^   r   r%   r  )rK   r  ra   namesr'   r  r   r  s   &       r   test_globals_from_builtins.TestInterpreterCall.test_globals_from_builtinss  s_    	6$$&C  !
 	 $?#d~'= 0$D$//# 	 ?
t4/"
 	 //KKf%& 0 	D,UG45 	$F8#C )D&)#D,XJg>?1? 0/s   	E*E*+E//E?	c                   R  pR p\         P                  ! 4       pVP                  VR4      pV P                  VR4       VP                  VR4      pV P	                  V4       VP                  R4       VP                  VR4      pV P                  V4       VP                  VR^*4       VP                  VR4      pV P                  V^*4       VP                  R4       R# )c                      V\        4       V &   R # rE   r  )r'   r  s   &&r   
set_globalHTestInterpreterCall.test_globals_from_stateless_func.<locals>.set_global  s    #GIdOrA   c                 4    \        4       P                  V 4      # rE   )rB  getr'   s   &r   
get_globalHTestInterpreterCall.test_globals_from_stateless_func.<locals>.get_global  s    9==&&rA   r-   r#   r  zspam = Truezassert spam == 42, repr(spam)N)r	   rY   rx  rJ   ry  r%   r+  )rK   r  r  ra   modnamer   s   &     r    test_globals_from_stateless_func4TestInterpreterCall.test_globals_from_stateless_func  s    	$	' $$&++j*5*-kk*f-#M"kk*f-J+kk*f-b!34rA   c                   \         P                  ! 4       p\        \        R/ 3\        R/ 3\
        R/ 3\        P                  R/ 3\        P                  R/ 3\        ^e4      R/ 3\        R4      P                  R/ 3\        P                  R/ 3\        R	/ 3\        R
/ 3\        RRR/3\        R/ 3\        R/ 3\        R/ 3.4       F  w  pw  r4pV P                  RV^,            24      ;_uu_ 4        V P                  4       ;_uu_ 4       pVP                  ! V.VO5/ VB pVP                  4        RRR4       V P                  XP                   4       RRR4       K  	  \        \"        R/ 3\#        ^*4      R/ 3.4       F  w  pw  r4pV P                  RV^,            24      ;_uu_ 4        V P                  4       ;_uu_ 4       pVP                  ! V.VO5/ VB pVP                  4        RRR4       V P%                  XP                   4       RRR4       K  	  V P                  4       ;_uu_ 4       pVP                  \&        4      pVP                  4        RRR4       V P%                  XP                   4       R#   + '       g   i     ELV; i  + '       g   i     EK  ; i  + '       g   i     L; i  + '       g   i     EKL  ; i  + '       g   i     L~; i)r   r  r  r  r  Nzinvalid case #rP   r  r  r  r  r  r  r  )r  )r	   rY   r  rw  r  r  r"  r(  r:  r$  rK  r   captured_thread_exceptioncall_in_threadrq   ry  caughtr  assertIsNotNoner  )rK   ra   r   r  r/  r0  ctxrr   s   &       r   test_call_in_thread'TestInterpreterCall.test_call_in_thread  su   $$&+4R$'R0("b1r2&y"-#YB%[__b"%YYB 126 6; =Ob1r2 3R86
 ,'A'  qse4553355--hHHHAFFH 6 !!#**-	 65!,, ,5"E2."2&B/6
 ,'A' qse4553355--hHHHAFFH 6 $$SZZ0	 65	, ++--%%&78AFFH . 	SZZ(% 655 655 65 655 .-sT   1J
'I>1#J,J:'J',#J:3&K>J		JJ$'J72J::KK	rP   N)r-   r/   r.   rQ   
contextlibcontextmanagerrS  rV  rd  rm  rr  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rR   rS   rT   s   @r   rM  rM  *  s     @ D DA7 
/":H<T((.$J:X<(i.VH,TJ04/0!7F+@Z56&) &)rA   rM  c                   ,   a  ] tR tRt o R tR tRtV tR# )TestIsShareablei  c                    . ROpV FL  pV P                  V4      ;_uu_ 4        \        P                  ! V4      pV P                  V4       R R R 4       KN  	  R #   + '       g   i     Kc  ; i)N)
N   spamr  r  iTFg      Y@rP   )r   )r  r  T)r   r	   r  r+  )rK   
shareablesr   	shareables   &   r   test_default_shareables'TestIsShareable.test_default_shareables  sR    
 Cc""(55c:		* #" """s   (AA*c                x    ! R  R4      p ! R R\         4      p\        R\        \        \        4       \	        4       VV! R4      V! R4      .	pV FS  pV P                  \        V4      4      ;_uu_ 4        V P                  \        P                  ! V4      4       RRR4       KU  	  R#   + '       g   i     Kj  ; i)c                   ,   a  ] tR tRt o R tR tRtV tR# )2TestIsShareable.test_not_shareable.<locals>.Cheesei  c                    Wn         R # rE   r  )rK   r'   s   &&r   r+  ;TestIsShareable.test_not_shareable.<locals>.Cheese.__init__  s     	rA   c                    V P                   # rE   r  r  s   &r   __str__:TestIsShareable.test_not_shareable.<locals>.Cheese.__str__  s    yy rA   r  N)r-   r/   r.   rQ   r+  r)  rR   rS   rT   s   @r   Cheeser%    s     !! !rA   r+  c                       ] tR tRtRtRtR# )4TestIsShareable.test_not_shareable.<locals>.SubBytesi  zA subclass of a shareable type.rP   N)r-   r/   r.   rQ   r  rR   rP   rA   r   SubBytesr-    s    1rA   r.  .Wensleydaler  N)
bytesr5  r1   r   r   r   r   r0  r	   r  )rK   r+  r.  not_shareablesr   s   &    r   r  "TestIsShareable.test_not_shareable  s    	! 	!	2u 	2
 }%! "Cd3i((   --c24 )( "(((s   4&B((B9rP   N)r-   r/   r.   rQ   r!  r  rR   rS   rT   s   @r   r  r    s     +(4 4rA   r  c                      a  ] tR tRt o 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 4       tRtV tR# )LowLevelTestsi  c                j   \         P                  R 4      pV P                  R4      ;_uu_ 4        \         P                  4       pV P                  W!4       V P	                  W!4       RRR4       V P                  R4      ;_uu_ 4        \         P                  R4      pV P                  W14       V P	                  W14       \         P                  R4      pV P                  WC4       V P	                  WC4       RRR4       R Fa  pV P                  RV: R24      ;_uu_ 4        \         P                  V4      pV P                  W!4       V P	                  W!4       RRR4       Kc  	  R \
        P                  ! RRRRRRR	R
7      R\
        P                  ! RRRRR\        \        4      RR
7      R\
        P                  ! RRRRRRRR
7      /p. ROpVP                  4        EF  w  rV P                  RV R24      ;_uu_ 4        T	p
\         P                  V4      pV P                  W:4       V P	                  W:4       \         P                  V4      pV P                  WC4       V P	                  WC4       RRR4       V P                  RV R24      ;_uu_ 4        T	p
\        V	4      p\         P                  ! V3/ VB pV P                  W*4       RRR4       V P                  RV R24      ;_uu_ 4        \        V	4      P                  4        UUu/ uF  w  rW'       * bK  	  pppV FX  pV	P                  V8X  d   K  WR&   \
        P                  ! R/ VB p
\         P                  ! V3/ VB pV P                  W*4       KZ  	  RRR4       \        V	4      P                  4        F  w  ppVR8X  d   V Uu. uF  qV8w  g   K  VNK  	  ppMV'       * .pV F  pV P                  V RV RV: RV: R24      ;_uu_ 4        VV/p\
        P                  ! R/ \        \        V	4      3/ VB B p
\         P                  ! V3/ VB pV P                  W*4       RRR4       K  	  K  	  EK  	  V P                  R4      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \         P                  RR7       RRR4       RRR4       \        VR,          4      P                  4        F  w  ppVR8X  d   K  \        V\        4      '       g   Q h^RRRR\!        4       3 Fk  pV P                  RV RV: R24      ;_uu_ 4        V P                  \"        4      ;_uu_ 4        \         P                  ! R/ VV/B  RRR4       RRR4       Km  	  K  	  R^RR\!        4       3 Ff  pV P                  RV: R24      ;_uu_ 4        V P                  \"        4      ;_uu_ 4        \         P                  VR7       RRR4       RRR4       Kh  	  R  Ff  pV P                  RV: R24      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \         P                  VR7       RRR4       RRR4       Kh  	  R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EK  ; i  + '       g   i     ELL; i  + '       g   i     EL; iu uppi   + '       g   i     ELj; iu upi   + '       g   i     EK:  ; i  + '       g   i     ELc; i  + '       g   i     ELo; i  + '       g   i     EL; i  + '       g   i     EKA  ; i  + '       g   i     ELu; i  + '       g   i     EK  ; i  + '       g   i     EL2; i  + '       g   i     EK  ; i)!isolatedzno argNdefaultr   z	default (r  FTown)use_main_obmalloc
allow_fork
allow_execallow_threadsallow_daemon_threadscheck_multi_interp_extensionsgillegacysharedemptyzsupported (znoop override (zoverride all (r?  r  r  z -> zextra overrider  r  g      ?zbad override (=zbad override (gil=)r?  )r   r7  )r7  rA  r8  rP   )r   r  )r   
new_configr   assert_ns_equalr  r8   r9   boolr
   r  r$   r?  r  r^   r  r5   r   r   )rK   r7  configconfig1config2r  	supportedgil_supportedr'   vanillar   	overrideskr   r?  fieldoldr  valr  s   &                   r   test_new_configLowLevelTests.test_new_config!  sU     **:6\\(##"--/F  1V- $
 \\)$$#..y9G  2W.#..y9G  2W. % #C	#233&11#6$$V5  1 43 # --"'  "%*.2 e++"&"%).2?.C U**"'  #%*.3'
	: 5&__.MDD6344"'2248$$W7  3'2248$$W6  2 5 vQ788" M	&11$D)D$$V6	 9 tfA67726w-2E2E2GH2G$!QX2G	H(C{{c) '*e$$44AyAH*55dHiHF((: ) 8 #7m113
sE>)6CAs(aaFCF"%gYF!CawbtC7!&LMM%*CL	#(#8#8 $"4=>I>$ "/!9!9$!L)!L,,V> NM " 49 /T \\*++"":..((d(3 / ,
 !7!34::<LE5~eT****RdFH=\\N5'5)1"EFF**955%00BE5>B 6 GF >	 = AsD&(3E 25)1=>>&&y11!,,,7 2 ?> 4 "E 25)1=>>&&z22!,,,7 3 ?> "a $##
 %$$ 433J 544 988 I 877 D NMM /.. ,++ 655 GFF 211 ?>>
 322 ?>>s  7Y9A/Z!8Z!A1Z66[
3[$["A![$5[8[8?A[=\&!\	8\&]	!\::]	]7 ]#7]7.^ ^#^ 9Z
	Z	!Z36[
[[$$[5=\\#	\&&\7	:]	]	] #]4.	]77^	^	^  ^2c                    \         P                  4       w  rV P                  V^ 4       V P                  V\         P                  4       V P                  \         P	                  V4      \         P                  4       R# r"   )r   r   rJ   WHENCE_RUNTIMEr   )rK   r   r   s   &  r   test_get_mainLowLevelTests.test_get_main  s^    (1131%!=!=>  *((	*rA   c                   V P                  R 4      ;_uu_ 4        \        P                  4       vr\        P                  4       w  r4V P	                  W14       V P	                  V\        P
                  4       RRR4       RpR pV P                  R4      ;_uu_ 4        \        P                  4       pV P                  Wu4      pV! V4      w  r4V P	                  W74       V P	                  V\        P                  4       RRR4       V P                  R4      ;_uu_ 4        ^ p	\        P                  4        F  vr\        W4      p	K  	  V	^,           pV P                  V4      pV! V4      w  r4V P	                  W;4       V P	                  V\        P                  4       RRR4       R#   + '       g   i     EL:; i  + '       g   i     L; i  + '       g   i     R# ; i)rw   Nz
            import _interpreters
            interpid, whence = _interpreters.get_current()
            print((interpid, whence))
            c                 "    \        V 4      w  rW3# rE   )r   )r   r   r   s   &  r   parse_stdout4LowLevelTests.test_get_current.<locals>.parse_stdout  s    #DzH##rA   r  r  )r   r   r   r   rJ   rU  rY   run_and_captureWHENCE_STDLIBr]   maxr   WHENCE_CAPI)rK   rw   r?   r   r   r(   rZ  origr   lastr   r   s   &           r   test_get_currentLowLevelTests.test_get_current  st   \\&!!$--/HD,88:HX,V]%A%AB	 "
	$ \\.// '')D''5D+D1HX,V]%@%@A 0 \\,''D'0024} 3axH**62D+D1HX0V]%>%>? ('- "!! 0/ (''s&   AF(A!F<A?G(F9	<G	G 	c                n   \         P                  4       vr\         P                  4       p\         P                  4       p\         P                  4       pV\         P                  3V\         P                  3V\         P                  3V\         P                  3.pV P                  R 4      ;_uu_ 4        \         P                  4       pV P                  Wv4       RRR4       V P                  R4      ;_uu_ 4        V P                  VR4      p\        V4      pV P                  Wv4       RRR4       V P                  R4      ;_uu_ 4        V^,           p	V	^,           p
VV	\         P                  3V
\         P                  3.,           pVV
\         P                  3.,           pV P                  R4      p\        V4      p\         P                  4       pV P                  W4       V P                  W4       RRR4       R#   + '       g   i     EL.; i  + '       g   i     L; i  + '       g   i     R# ; i)rw   Nzvia interp from _interpretersz{
                import _interpreters
                print(
                    _interpreters.list_all())
                zvia interp from C-APIz
                import _interpreters
                _interpreters.create()
                print(
                    _interpreters.list_all())
                )r   r   rY   rU  r]  r   r]   rJ   r\  r   r_  r   )rK   r   r?   r   r   r   r   r   r   r   r   r   	expected3r   res3s   &              r   test_list_allLowLevelTests.test_list_all  s   "++-
!((*	!((*	!((*	]112334334334	
 \\&!!((*CS+ " \\9::''	 8 D t*CS+ ; \\122!AI!AI M556M778$ I !M778$ I ** 0 D :D ))+DT-T-' 32 "!! ;: 322s%   1&G<8/HB*H#<H	H 	#H4	c           	     	   \         P                  R 4      p\         P                  R4      pTpV P                  R4      ;_uu_ 4        \         P                  4       p\         P	                  V4      pV P                  WS4       RRR4       V P                  R4      ;_uu_ 4        \         P                  R4      p\         P	                  V4      pV P                  WS4       RRR4       V P                  R4      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \         P                  R4       RRR4       RRR4       RVRVR VRV/P                  4        Ff  w  rgV P                  R	V: 24      ;_uu_ 4        \         P                  V4      p\         P	                  V4      pV P                  WW4       RRR4       Kh  	  V P                  R
4      ;_uu_ 4        \         P                  R4      pRVn	        \        \        4      Vn        RVn        \         P                  V4      p\         P	                  V4      pV P                  WX4       RRR4       V P                  R4      ;_uu_ 4        \         P                  4       pV=V P                  \        4      ;_uu_ 4        \         P                  V4       RRR4       RRR4       V P                  R4      ;_uu_ 4        \         P                  4       pRVn        V P                  \        4      ;_uu_ 4        \         P                  V4       RRR4       RRR4       V P                  R4      ;_uu_ 4        \         P                  4       pV P!                  \         P#                  V4      \         P$                  4       RRR4       R#   + '       g   i     EL7; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EK  ; i  + '       g   i     EL; i  + '       g   i     ELu; i  + '       g   i     EL; i  + '       g   i     EL%; i  + '       g   i     EL1; i  + '       g   i     R# ; i)r6  r@  zno argsNzconfig: Nonezconfig: 'empty'rB  r   r7  z	str arg: rD  TrA  zmissing fieldszextra fieldsr   )r   rD  r   rY   
get_configrE  r^   r   r  r9  rF  r
   r>  r?  r  r  rJ   r   r]  )	rK   r6  r@  r7  r   rG  r  r   r`  s	   &        r   test_createLowLevelTests.test_create  sE    ++J7))(3\\)$$$++-H"--h7F  1 %
 \\.))$++D1H"--h7F  1 *
 \\-..""#344$$W- 5 / wf	

 %'MC 	#122(//4&11(;$$V6 32 \\(## ++G4D%)D"15o1FD.DH$++D1H"--h7F  . $ \\*++ ++-D"":..$$T* / , \\.)) ++-DDI"":..$$T* / * \\(##$++-H$$X.++- $#_ %$$
 *)) 544 /.. 322
 $## /.. ,++ /.. *)) $##s   ;N/"<O?O+O	3O+=<O?A3P24P<&P(	<P<%9Q$Q	4Q$AQ8/O 	O	O("	O++O<	?PP%	(P93	P<<Q	Q!	Q$$Q5	8R		c           	     T   V P                  R 4      ;_uu_ 4        \        P                  4       p\        P                  4        UUu. uF  vr#VNK  	  ppp\        P	                  V4       \        P                  4        UUu. uF  vr#VNK  	  pppV P                  W4       V P                  W4       V P                  V P                  V4      4       RRR4       V P                  R4      ;_uu_ 4        \        P                  4       vrV P                  \        4      ;_uu_ 4        \        P	                  V4       RRR4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! 4       pV P                  \        R4      ;_uu_ 4        \        P	                  VRR7       RRR4       V P                  V P                  V4      4       \        P	                  V4       V P                  V P                  V4      4       RRR4       V P                  R4      ;_uu_ 4        \        P                  ! 4       pV P                  V P                  V4      4       \        P                   ! VRR7       V P                  V P                  V4      4       RRR4       R# u uppi u uppi   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELG; i  + '       g   i     L; i  + '       g   i     R# ; i)	r  Nrw   r  r  Trestrictzbasic C-API)basic)r   r   rY   r]   destroyr\   assertNotInr0  r  r   r^   r   r   create_interpreterr  r+  destroy_interpreter)rK   r   r   r?   r   rg  s   &     r   test_destroyLowLevelTests.test_destroy-  sG   \\.//$++-H'4'='='?@'?VRb'?F@!!(+&3&<&<&>?&>FBR&>E?MM(+X-""8,. 0 \\&!!(113LH""#344%%h/ 5 " \\,''(;;=H''(8.II%%h%> JOO""8,.!!(+""8,. ( \\-(((;;=HOO""8,.11($G""8,. )(3 A?	 0// 544 "!! JII (' )((s   ,J3J'
/J3J-
AJ333K&K	<K%4LK/	1AL/A.L'J33K	K	KK,	/L :	LL	L'	c                L   V P                  R 4      ;_uu_ 4        \        P                  R4      pRVn        \        '       d   RVn        \        P                  4       vr#\        P                  V4      pV P                  WA4       RRR4       V P                  R4      ;_uu_ 4        \        P                  R4      p\        P                  R4      p\        P                  V4      pV P                  WA4       RRR4       V P                  R4      ;_uu_ 4        \        P                  R4      p\        P                  R4      p\        P                  V4      pV P                  WA4       RRR4       V P                  R4      ;_uu_ 4        \        P                  R4      pV P                  V4      ;_uu_ 4       pV P                  \        R4      ;_uu_ 4        \        P                  VRR	7       RRR4       \        P                  V4      pRRR4       V P                  XV4       RRR4       R#   + '       g   i     EL; i  + '       g   i     ELW; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lz; i  + '       g   i     R# ; i)
rw   r@  r8  FNr6  r  r  Trn  )r   r   rD  r?  r
   r>  r   rj  rE  rY   ra  r  r   )rK   r   r   r?   rG  r`  s   &     r   test_get_configLowLevelTests.test_get_configR  s    \\&!!$//9H HL9>6(113LH"--h7F  2 " \\*%%$//
;H$++J7H"--h7F  2	 & \\(##$//9H$++H5H"--h7F  2	 $ \\,'' ++J7D++D11X++,<nMM!,,X,E N&11(; 2   . ('+ "!! &%% $# NM 21 (''sb   A+H1&AIAI
/J9I?	I,0I?	J1I	I	I)	,I<7I?	?J
JJ#	c           
        V P                  R 4      ;_uu_ 4        \        P                  4       vr\        P                  V4      pV P	                  V\        P
                  4       RRR4       V P                  R4      ;_uu_ 4        \        P                  4       p\        P                  V4      pV P	                  V\        P                  4       RRR4       \        P                  R\        P                  R\        P                  R\        P                  R/P                  4        Fx  w  rEV P                  RV RV R	24      ;_uu_ 4        V P                  VR
7      ;_uu_ 4       p\        P                  V4      pRRR4       V P	                  XV4       RRR4       Kz  	  V P                  R4      ;_uu_ 4        V P                  \        R4      RR7      p\!        V4      pV P	                  V\        P                  4       RRR4       V P                  R4      ;_uu_ 4         V P                  \        R4      RR7      p\!        V4      pV P	                  V\        P                  4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL,; i  + '       g   i     EK  ; i  + '       g   i     L; i  + '       g   i     R# ; i)rw   Nstdlibz	not readyr   r   r   zfrom C-API (z: r  )r   zfrom C-API, runningz
                import _interpreters
                interpid, *_ = _interpreters.get_current()
                print(_interpreters.whence(interpid))
                T)rG  zfrom legacy C-API, runningF)r   r   r   r   rJ   rU  rY   r]  WHENCE_UNKNOWNWHENCE_LEGACY_CAPIr_  	WHENCE_XIr  ra  r   r   r   )rK   r   r?   r   r`  r'   r   s   &      r   r  LowLevelTests.test_whences  sK   \\&!!(113LH"))(3FV]%A%AB "
 \\(##$++-H"))(3FV]%@%@A $ ((+,,n%%w##%>	

 %'JD TF"TF!<==//t/<<*11(;F =  . >= \\/00**6 7 ,
  + D $ZFV]%>%>? 1 \\677**6 7 ,
  + D $ZFV]%E%EF 87? "!!
 $## =<< >==
 10 877sW   AI9A
JJ5(J!>J5=AK
&A	K9J
	J	!J2,	J55K
K	K.	c                    R p\         P                  4       pV P                  W!4      pV P                  VP	                  4       R4       R# )zx
            import contextvars
            print(getattr(contextvars.Token, "MISSING", "'doesn't exist'"))
            z<Token.MISSING>N)r   rY   r\  rJ   r>  )rK   r(   r`  r   s   &   r   test_contextvars_missing&LowLevelTests.test_contextvars_missing  s@    
 ##%##D1'89rA   c                |  a  V 3R  lpS P                  R4      ;_uu_ 4        \        P                  4       pS P                  V4      ;_uu_ 4        \        P	                  V4      pS P                  V4       RRR4       RRR4       S P                  R4      ;_uu_ 4        \        P                  4       p\        P	                  V4      pS P                  V4       RRR4       S P                  R4      ;_uu_ 4        \        P                  4       vr$V! VR4       RRR4       S P                  R4      ;_uu_ 4        S P                  4       ;_uu_ 4       pS P                  VRR7      ;_uu_ 4        V! VR4       RRR4       RRR4       RRR4       S P                  R4      ;_uu_ 4        S P                  4       ;_uu_ 4       pS P                  VR	R7      ;_uu_ 4        V! VR	4       RRR4       RRR4       RRR4       S P                  R
4      ;_uu_ 4        S P                  4       ;_uu_ 4       pV! VR	4       RRR4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL{; i  + '       g   i     EL/; i  + '       g   i     EL;; i  + '       g   i     ELG; i  + '       g   i     L; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)c                    < SP                  \        R 4      ;_uu_ 4        \        P                  V RR7       RRR4       \        P                  V 4      pSP	                  W!4       R#   + '       g   i     L8; i)r  Trn  N)r  r   r   r,  r   )r   r   re  rK   s   && r   check,LowLevelTests.test_is_running.<locals>.check  sV    ''(8.II((D(A J#..x8GMM', JIs   A((A8	zfrom _interpreters (running)Nz from _interpreters (not running)rw   Tzfrom C-API (running __main__)r\  z&from C-API (running, but not __main__)Fzfrom C-API (not running))
r   r   rY   re  r,  r+  r0  r   ra  rd  )rK   r  r   re  r?   s   f    r   test_is_runningLowLevelTests.test_is_running  s>   	- \\899$++-Hh'''228<( ( : \\<==$++-H#..x8GW% >
 \\&!!(113LH(D! " \\9::++--++H4+@@(D) A . ;
 \\BCC++--++H5+AA(E* B . D
 \\455++--h& . 65/ ('' :99 >==
 "!! A@@ .-- ;:: BA .-- DCC .- 655s   .I$'I	6I$;I8;J;KJ4	0
J :J4	K+LK/	 
K*K/	2LL*4
L	>L*I!	I$$I5	8J		J	 J1+	J4	4K?	KK	K,'K/	/L :	LL	L'"L**L;	c                   V P                  R 4      ;_uu_ 4        \        P                  4       p\        R4      w  r#V;_uu_ 4        \        P	                  W4      pRRR4       VP                  4       pVP                  4        VP                  pV P                  VR4       RRR4       V P                  R4      ;_uu_ 4        \        P                  4       p\        R4      w  r#V;_uu_ 4        \        P	                  W4      pVP                  4       pRRR4       \        \        RXP                  VP                  R7      pV P                  XR4       V P                  WF4       RRR4       V P                  R	4      ;_uu_ 4        V P                  4       ;_uu_ 4       pV P                  \         R
4      ;_uu_ 4        \        P	                  VRRR7       RRR4       \        P	                  VR4      pRRR4       V P#                  XR4       V P                  VP$                  R4       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELS; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)z
run scriptr  Nr  uncaught exceptionzg
                raise Exception('uh-oh!')
                print("it worked!", end="")
                r  r3   r4   r   r  r  r  Trn  )r   r   rY   r   r%   r  r  r  rJ   r@   r   r3   r4   rE  ra  r  r   r  r2   )rK   r   r(   r  r>  rx   r   s   &      r   	test_execLowLevelTests.test_exec  s   \\,''$++-H./LMOF#((: mmoG##%..CS,/ ( \\.//$++-H. 0 OF #((:nn&  %8-->>	H S"%  /! 0$ \\,''++--++,<nMM!&&x1P04 ' 6 N $((3RS	 .
 S$'SWWl3 ('3  (''   0//( NM .- (''s   ,IH7	AI,I3/&I	AI3J-!J	 JJ	76J-7I	II	I0*	I33J	JJ	J*%J--J>	c                   \         P                  4       pV P                  R 4      ;_uu_ 4        \        P                  p\         P                  W4      w  r4V P                  V4       V P                  V4       RRR4       V P                  R4      ;_uu_ 4        \        P                  p\         P                  WR/ 4      w  r4V P                  V4       V P                  V4       RRR4       V P                  R4      ;_uu_ 4        \        P                  p\         P                  W4      w  r4V P                  V4       V P                  VR4       RRR4       V P                  R4      ;_uu_ 4        ^^^^^^RR^	R^ /3p\        P                  pRp\        ^^^	^ R7      p\         P                  WWg4      w  r4V P                  V4       V P                  W54       RRR4       V P                  R	4      ;_uu_ 4        \        P                  p\         P                  W4      w  r4\        \        R
VP                  VP                   R7      pV P                  V4       V P                  WE4       RRR4       R#   + '       g   i     EL	; i  + '       g   i     EL; i  + '       g   i     ELX; i  + '       g   i     L; i  + '       g   i     R# ; i)zno args, return NoneNzempty args, return Nonezno args, return non-NoneTzfull args, return non-Noner  r  r  r  r~  r  rP   )      )r   r  r~   r  r  r  )r   rY   r   r  spam_minimalrx  ry  script_with_returnr   r  r  rJ   spam_raisesr@   r   r3   r4   )rK   r   rz  r   r>  r   r/  r0  s   &       r   	test_callLowLevelTests.test_call  s5    '') \\011$$D$))(9HCc"c"	 2 \\344$$D$))("bAHCc"c"	 5 \\455**D$))(9HCc"MM#t$	 6 \\6771aAq&332BCH&&D%DAa1-F$))($GHCc"S+ 8 \\.//##D$))(9HC$7-->>	H c"S+ 0/7 211 544 655 87 0//s@   A
I8AJAJ 2A*J4=A1K8J		J	 J1	4K	K	c                   V P                  R 4      ;_uu_ 4        \        P                  4       p\        P                  VR4      p\        P                  VR4      pV P	                  VP
                  P                  R4       V P	                  VP
                  P                  R4       \        P                  V\        R^*R7      4       \        P                  VR4      p\        P                  VR4      p\        P                  VR4      pV P                  VR4       V P                  VR4       V P	                  VP
                  P                  R4       V P                  \        4      ;_uu_ 4        \        P                  VR	^/4       RRR4       RRR4       V P                  R
4      ;_uu_ 4        V P                  4       ;_uu_ 4       pV P                  \        R4      ;_uu_ 4        \        P                  VRR/RR7       RRR4       \        P                  VRR/4       \        P                   ! VR4      pRRR4       V P	                  X^ 4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Le; i  + '       g   i     R# ; i)r  zassert spam == 'eggs'zassert ham == 42r  r  )r  r  zassert spam == 42NAssertionError r  r  r  Trn  r  )r   r   rY   r%   rJ   r1   r-   set___main___attrsr  r   r^   r  ra  r  r   r   exec_interpreter)rK   r   before1before2after1after2after3rcs   &       r   test_set___main___attrs%LowLevelTests.test_set___main___attrs!	  s   \\.//$++-H#((3LMG#((3EFGW\\22K@W\\22K@,,Xt8  #''2KLF"''2DEF"''2EFFMM&$'MM&$'V[[113CD"":..00FA;G /% 0, \\,''++--++,<nMM!44X~>B 5 D N 00FD>J&77) . R# ('	 /.% 0/0 NM .- (''s`   EI41I!	
I43J-J	+J7J	=J-!I1,I44J	JJ	J*%J--J>	rP   N)r-   r/   r.   rQ   rR  rV  rb  rg  rk  r   ru  rx  r  r  r  r  r  r  rR   rS   rT   s   @r   r4  r4    s     x8t*@B-.^8-t ". ".H/B )G )GV:"'H$4L,,\ !$ !$rA   r4  r#   )NNNrE   )Jr  r6  r   r  textwrapr   rm   r8   ri  testr   test.supportr   r   r   import_moduler   
concurrentr	   r
   r   test._crossinterp_definitions_crossinterp_definitionsr  concurrent.interpretersr   r   r   utilsr   r   r   r   r   r   r  r   WHENCE_STR_LEGACY_CAPIr   WHENCE_STR_XIr   r   r  r+   r@   rC   rW   r   r   r   r   r)  rl  r  r  r  rw  r  r  r  r  r  r  r  r  r  r   r"  rK  rM  r  r4  r-   rw   rP   rA   r   <module>r     s    	  
      " & &++O< # ( , ,    # ' )*  # # #<(( ($<S( <S~$8 $":2h :2zB*8 B*Je4X e4Ps&x s&lg28 g2TED EDPt( tv ""''$$ 

* *2$&D $&Nw
)( w
)t14h 14hk$H k$\ zMMO rA   