+
    Bi                        ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
Ht ^ RI
Ht ^ RI
Ht ^ RIHtHtHtHtHt ^ RIHt ]	P*                  '       g   ]P,                  ! R4      hR	 t ! R
 R]P0                  4      t]P4                  ! ]! 4       R4       ! R R]P0                  4      4       t ! R R]P0                  4      tR t]R8X  d   ]P>                  ! 4        R# R# )    N)support)	os_helper)force_not_colorized)threading_helper)spawn_pythonkill_pythonassert_python_okassert_python_failure interpreter_requires_environmentdedentztest module requires subprocessc                 >    \        V 4      pV P                  4       pW3# N)r   wait)pdata
returncodes   &  )/usr/lib/python3.14/test/test_cmd_line.py_kill_python_and_exit_coder      s    q>DJ    c                   	  a  ] tR t^#t o R tR t]P                  R 4       t]P                  R 4       t	]P                  R 4       t
]P                  R 4       tR tR t]P                  R	 4       tR
 t]P"                  ! ]! 4       R4      R 4       tR t]P                  R 4       t]P                  R 4       tR tR tR tR t]P6                  ! ]P:                  R4      R 4       t]P6                  ! ]P:                  R4      R 4       t]P"                  ! ] PB                  R8H  R4      R 4       t"]P"                  ! ] PB                  R8H  R4      R 4       t#]P6                  ! ] PB                  R8H  ;'       g    ]PH                  R4      R 4       t%]P"                  ! ]&PN                  PQ                  RR4      R8g  R 4      R! 4       t)R" t*R# t+R$ t,]P"                  ! ] PZ                  P\                  R%4      R& 4       t/R' t0R( t1R) t2R* t3R+ t4R, t5R- t6R. t7]P"                  ! ]&Pp                  R/8g  R04      ]P"                  ! ] PB                  R18H  R24      R3 4       4       t9R4 t:R5 t;R6 t<R7 t=R8 t>R9 t?]P                  R: 4       t@]P"                  ! ]! 4       R;4      R< 4       tAR= tBR> tCR?R@RAR@/RB ltD]P                  RC 4       tERmRD ltFRE tGRF tH]P                  RG 4       tIRH tJRI tKRJ tL]P6                  ! ]MP                  ! RK4      RL4      RM 4       tO]P6                  ! ]MP                  ! RK4      RL4      RN 4       tP]P6                  ! ] PB                  R8H  RO4      RP 4       tQ]P6                  ! ]P                  RQ4      RR 4       tS]P6                  ! ]P                  RQ4      RS 4       tT]P"                  ! RT]MP                  ! 4       PQ                  RURk4      9   RV4      RW 4       tVRX tWRY tX]P6                  ! ]MP                  ! RZ4      R[4      R\ 4       tY]P6                  ! ] PB                  R8H  R]4      R^ 4       tZ]P                  R_ 4       t[R` t\Ra t]Rb t^Rc t_Rd t`Re taRf tb]P6                  ! ]P                  Rg4      ]dP                  ! 4       Rh 4       4       tf]P6                  ! ]P                  Rg4      ]dP                  ! 4       Ri 4       4       tg]P6                  ! ]P                  Rg4      Rj 4       thRktiV tjRl# )nCmdLineTestc                2    \        R 4       \        R4       R# ).z< .N)r
   selfs   &r   test_directoriesCmdLineTest.test_directories$   s    c"e$r   c                    \        V4      w  r#pVR 8w  d   V P                  VR4       V P                  RV4       V P                  RV4       V# )r      
s	   Traceback)r	   assertEndsWithassertNotIn)r   cmd_linercouterrs   &&   r   verify_valid_flagCmdLineTest.verify_valid_flag(   sL    '1#:U+s+s+
r   c                <   V P                  R 4       V P                  R4       V P                  R4      pVP                  4       pV P                  RV^ ,          4       V P                  RV4       V P                  RV4       V P	                  \        V4      ^24       R# )z-hz-?z--help   usage
   PYTHONHOME   -X devN)r'   
splitlinesassertInr"   
assertLesslenr   r%   liness   &  r   	test_helpCmdLineTest.test_help0   s~    t$t$$$X. ha),C(E
B'r   c                L    V P                  R 4      pV P                  RV4       R# )z
--help-envr+   Nr'   r.   r   r%   s   & r   test_help_envCmdLineTest.test_help_env;   s     $$\2mS)r   c                L    V P                  R 4      pV P                  RV4       R# )z--help-xoptionsr,   Nr6   r7   s   & r   test_help_xoptionsCmdLineTest.test_help_xoptions@   s!    $$%67i%r   c                   V P                  R 4      pVP                  4       pV P                  RV^ ,          4       V P                  RV4       V P                  RV4       RP                  VR,          4      P	                  R4       R# )z
--help-allr*   r+   r,   r   :   NNasciiN)r'   r-   r.   joindecoder1   s   &  r   test_help_allCmdLineTest.test_help_allE   si    $$\2 ha)mS)i% 	r""7+r   c                J    V P                  R 4       V P                  R4       R# )z-Oz-OONr'   r   s   &r   test_optimizeCmdLineTest.test_optimizeQ   s    t$u%r   c                (    V P                  R 4       R# )-SNrE   r   s   &r   test_site_flagCmdLineTest.test_site_flagU   s    t$r   c                    R \         P                  R,          ,          P                  R4      pR F3  p\        V4      w  r4pV P	                  WQ4       V P                  WA4       K5  	  R# )zPython %d.%d:N   Nr?   N)z-Vz	--versionz-VV)sysversion_infoencoder	   assertNotStartsWithassertStartsWith)r   versionswitchr$   r%   r&   s   &     r   test_versionCmdLineTest.test_versionX   sV    !C$4$4R$88@@I.F+F3LBS$$S2!!#/ /r   c                    \        R 4      w  rpV P                  RV4       \        R4      w  rpV P                  RV4       R# )z-vs   stack overflowz-vvN)r	   r"   r   r$   r%   r&   s   &   r   test_verboseCmdLineTest.test_verbose`   sB     (-*C0'.*C0r   z6Cannot run -E tests when PYTHON env vars are required.c                |    R  pV! 4       pV P                  V/ 4       V! RR4      pV P                  VRRRR/4       R# )c                      \         P                  R 3V ,           p V R,          p \        P                  ! V 4      p\	        VP                  4       ^ ,          4      pV# )-E)-c import sys; print(sys._xoptions))rN   
executable
subprocesscheck_outputevalr-   )argsr%   optss   *  r   get_xoptions/CmdLineTest.test_xoptions.<locals>.get_xoptionsl   sM     NND)D0D>>D))$/C(+,DKr   z-Xaz	-Xb=c,d=eaTbzc,d=eN)assertEqual)r   rf   re   s   &  r   test_xoptionsCmdLineTest.test_xoptionsi   sE    	 ~r"E;/T389r   c                j  a  V 3R  lpRpV! RV4      w  r4pS P                  VP                  4       R4       S P                  VR4       V! RRRRV4      w  r4pS P                  VP                  4       R4       \        P                  '       d   S P	                  VR	4       R
# S P                  VR4       R
# )c                  h  < \         P                  .pVP                  V 4       \        P                  p\        P
                  ! WVR 7      pVP                  4       w  rEVP                  P                  4        VP                  P                  4        VP                  pSP                  V^ 4       WdV3# )stdoutstderr)rN   r`   extendra   PIPEPopencommunicaterp   closerq   r   rj   )rd   cmdrs   r   r%   r&   r$   r   s   *      r   
run_python1CmdLineTest.test_showrefcount.<locals>.run_python|   s     >>"CJJt??D  $?A}}HCHHNNHHNNBR#C<r   r_   r^   s   {}r   -I-Xshowrefcounts   {'showrefcount': True}s   ^\[-?\d+ refs, \d+ blocks\]N)rj   rstripr   Py_DEBUGassertRegex)r   rx   coder$   r%   r&   s   f     r   test_showrefcountCmdLineTest.test_showrefcount{   s    	  2!$-u-c"!$ndDI'@A S"ABS#&r   c                
   0 RmpV Fd  w  r#RRV 2RR.pV P                  V4      ;_uu_ 4        \        V!  pV P                  VP                  P	                  R4      V4       RRR4       Kf  	  R#   + '       g   i     K{  ; i)=onr{   frozen_modulesr^   ,import os; print(os.__spec__.loader, end="")utf-8N>   z=offSourceFileLoader FrozenImporter=r   r   r   subTestr	   r   r%   rA   r   testsrawexpectedrw   ress   &     r   test_xoption_frozen_modules'CmdLineTest.test_xoption_frozen_modules   s{    
 #MC>#/GICc""&,  !8(C #" # #""s   5A11Bc                   RR0pV Fa  w  r#RR.pV P                  V4      ;_uu_ 4        \        VRV/ pV P                  VP                  P	                  R4      V4       RRR4       Kc  	  R#   + '       g   i     Kx  ; i)onr^   r   PYTHON_FROZEN_MODULESr   N)r   r   )offr   r   r   s   &     r   test_env_var_frozen_modules'CmdLineTest.test_env_var_frozen_modules   sw     %'
 #MCGHCc""&G3G  !8(C #" #"""s   7A..A?c                j    \        R 4       \        R R4       \        R RR4       \        R RRR4       R# )-mfnord43520xyzrunpytimeit-n1Nr
   r	   r   s   &r   test_run_moduleCmdLineTest.test_run_module   s2     	d#dO4 	dG_=xs3r   c                2   \        R RRRR4      pVP                  P                  R4       VP                  P                  R4       \        V4      pV P	                  VP                  R4      R
8g  4       V P	                  VP                  R4      R
8g  4       R	# )-ir   r   r   r   s   Timer
   exit()
s   1 loops   __main__.TimerN)r   stdinwriter   
assertTruefind)r   r   r   s   &  r   test_run_module_bug1764407&CmdLineTest.test_run_module_bug1764407   st     tXtS9	j!	k"1~		),23		"34:;r   c                   \         P                  P                  \        4      P	                  R 4      p\
        P                  ! V4      ;_uu_ 4        \        RRR4       \        RRR4       RRR4       R#   + '       g   i     R# ; i)testr   unittestztest/test_longexp.pyz./test/test_longexp.pyN)ospathdirname__file__removesuffixr   
change_cwdr	   )r   projectlibpaths   & r   test_relativedir_bug46421%CmdLineTest.test_relativedir_bug46421   s[     2??G!!.11T:/EFT:/GH 2111s   A66B	c                L    \        R 4       \        R R4       \        R R4       R# )r^   zraise ExceptionpassNr   r   s   &r   test_run_codeCmdLineTest.test_run_code   s!     	d#d$56v&r   zneed os_helper.FS_NONASCIIc                ~    R \         P                  : R\        \         P                  4      : R2p\        RV4       R# )zassert(ord(z) == )r^   N)r   FS_NONASCIIordr	   )r   commands   & r   test_non_asciiCmdLineTest.test_non_ascii   s,      ++S1F1F-GIw'r   c                    \         P                  pR V R2p\        RV4      pV P                  VP                  P                  4       \        V4      P                  R4      4       R# )z# coding: latin1
print(ascii('z'))r^   r?   N)r   r   r	   rj   r%   r}   r?   rP   )r   chrw   r   s   &   r   test_codingCmdLineTest.test_coding   sS     ""/t37tS))59+;+;G+DEr   win32z Windows has a native unicode APIc                   R p\         P                  P                  4       pRVR&   RVR&   RV,           R,           p\        P                  ! \
        P                  RV.\        P                  \        P                  VR7      pVP                  4       w  rVVP                  ^8X  d   R	pM1VP                  ^ 8X  d   R
pM\        RVP                  : RV: 24      hVP                  V4      '       g   \        V: RV: 24      hR# )   CLC_ALL0PYTHONCOERCECLOCALEs   import locale; print(ascii("s   "), locale.getencoding())r^   )rp   rq   envs3   Unable to decode the command from the command line:s   '\xff' zUnknown exit code: z	, output=z doesn't start with N)r   environcopyra   rt   rN   r`   rs   STDOUTru   r   AssertionError
startswith)r   undecodabler   r   r   rp   rq   patterns   &       r   test_undecodable_code!CmdLineTest.test_undecodable_code   s     jjooH%(!"*+.)) 	 ^^T4(??:+<+< <<1
 MG\\Q "G !q||U[!\]]  )) vw!OPP *r   c           
     h  a
 R o
V
3R lpV
3R lpV
3R lpRP                  R4      pRpWE.pWV3 Fj  pV P                  VR7      ;_uu_ 4        V F>  pV! V4      p	V P                  V	P                  P	                  4       \        V4      4       K@  	  RRR4       Kl  	  R#   + '       g   i     K  ; i)	z;import sys, os; s=os.fsencode(sys.argv[1]); print(ascii(s))c                 z   < \         P                  R SV .p\        P                  ! V\        P                  RR7      # )r^   Trp   textrN   r`   ra   runrs   argrw   r   s   & r   run_default6CmdLineTest.test_invalid_utf8_arg.<locals>.run_default   s,    >>4s3C>>#jooDIIr   c                    < \         P                  R SV .p\        \        P                  4      pRVR&   \
        P                  ! V\
        P                  RVR7      # )r^   r   r   T)rp   r   r   )rN   r`   dictr   r   ra   r   rs   )r   rw   r   r   s   &  r   run_c_locale7CmdLineTest.test_invalid_utf8_arg.<locals>.run_c_locale$  sJ    >>4s3Crzz"CCM>>#joo'+6 6r   c                 ~   < \         P                  R RRSV .p\        P                  ! V\        P                  RR7      # )r{   utf8r^   Tr   r   r   s   & r   run_utf8_mode8CmdLineTest.test_invalid_utf8_arg.<locals>.run_utf8_mode+  s0    >>4tSAC>>#jooDIIr      e:é, euro:€, non-bmp:􏿿r   s   é)run_cmdN)rP   r   rj   rp   r}   r?   )r   r   r   r   
valid_utf8invalid_utf8	test_argsr   r   procr   s   &         @r   test_invalid_utf8_arg!CmdLineTest.test_invalid_utf8_arg  s     M	J	6	J ?EEgN
( 	  .	#=AGg..$C"3<D$$T[[%7%7%95:F % /. B...s   AB  B1darwinz%test specific to Mac OS X and Androidc                   R P                  R4      pRpVP                  RR4      p\        V4      P                  R4      R,           p\        P                  P                  4       pRVR&   \        P                  ! \        P                  RW!3\        P                  VR	7      pVP                  4       w  rxV P                  Wt4       V P                  VP                  ^ 4       R
# )r   r   z%import sys; print(ascii(sys.argv[1]))surrogateescaper?   r    r   r   r^   )rp   r   N)rP   rA   r?   r   r   r   ra   rt   rN   r`   rs   ru   rj   r   )	r   r   r   decodedr   r   r   rp   rq   s	   &        r   test_osx_android_utf8!CmdLineTest.test_osx_android_utf8A  s     9??H6++g'89>((1E9jjoo H^^T4.?? *q)r   PYTHONUNBUFFEREDr   z#Python stdio buffering is disabled.c                    \         P                  ! R 4      p\        P                  RV.p\        P
                  ! V\        P                  \        P                  RRR7      pV P                  VP                  R4       R# )z
            import sys
            out = sys.stdout
            print(out.isatty(), out.write_through, out.line_buffering)
            err = sys.stderr
            print(err.isatty(), err.write_through, err.line_buffering)
        r^   T)rp   rq   r   checkz#False False False
False False True
N)	textwrapr   rN   r`   ra   r   rs   rj   rp   )r   r   rd   r   s   &   r   %test_non_interactive_output_buffering1CmdLineTest.test_non_interactive_output_bufferingW  sd         d+~~d:??%/__4tM.	/r   c                   R
 F  pRV,          p\        RRV4      w  r4pVR8X  d   TMTpV P                  VRRV,          4       RV,          p\        RRV4      w  r4pVR8X  d   TMTpV P                  VRRV,          4       K  	  R	# )rp   rq   z6import os, sys; sys.%s.buffer.write(b'x'); os._exit(0)-ur^      xzbinary %s not unbufferedz.import os, sys; sys.%s.write('x'); os._exit(0)ztext %s not unbufferedNro   r	   rj   )r   streamr   r$   r%   r&   r   s   &      r   test_unbuffered_output"CmdLineTest.test_unbuffered_outputh  s    *FLD+D$=LBS H,3#DT4)Cf)LMDD+D$=LBS H,3#DT4)AF)JK +r   c                    R p\        RRV4      pVP                  P                  R4       VP                  P                  4        \	        V4      w  r4V P                  V^ 4       V P                  VR4       R# )z/import sys; sys.stdout.write(sys.stdin.read(1))r  r^   r  N)r   r   r   flushr   rj   rR   )r   r   r   r   r$   s   &    r   test_unbuffered_input!CmdLineTest.test_unbuffered_inputx  s^    AtT*	d	-a0QdD)r   c                    RpRpV\         P                  ,           V,           pRp\        RRVVR7      w  rVpV P                  VP	                  R4      V4       V P                  VP	                  R4      V4       R# )	ABCDEif 1:
            import sys
            path = ":".join(sys.path)
            path = path.encode("ascii", "backslashreplace")
            sys.stdout.buffer.write(path)rI   r^   
PYTHONPATHr?   N  ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE  FGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJ)r   pathsepr	   r.   rP   )r   path1path2r   r   r$   r%   r&   s   &       r   test_large_PYTHONPATH!CmdLineTest.test_large_PYTHONPATH  sm    rzz!E)-
 (dD379ell7+S1ell7+S1r   z'PYTHONSAFEPATH changes default sys.pathc                p    R p\        RVRR7      w  r#p\        RVRR7      w  rVpV P                  W64       R# )r  r^   r   r  F)
__isolatedNr  )r   r   rc1out1err1rc2out2err2s   &       r    test_empty_PYTHONPATH_issue16309,CmdLineTest.test_empty_PYTHONPATH_issue16309  s?    -
 +4"E4*4%H4 	$r   c           	     &   R	 EF	  p\         P                  P                  4       pWR&   \        P                  ! \
        P                  R.\        P                  \        P                  \        P                  VR7      pRpVP                  P                  \        V4      P                  R 4      R,           4       VP                  P                  R4       \        V4      p\        V4      P                  VR4      pV P                  We4       EK  	  R# )
r?   PYTHONIOENCODINGr   )r   rp   rq   r   u   a=é b= c=𐀀 d=􏿿r    r   backslashreplaceN)r?   zlatin-1r   )r   r   r   ra   rt   rN   r`   rs   r   r   r   r?   rP   r   reprr.   )r   encodingr   r   r   r   escapeds   &      r   test_displayhook_unencodable(CmdLineTest.test_displayhook_unencodable  s    5H**//#C&."#  & oo!!((A ?DGGMM%+,,W5=>GGMM+&q>D4j''2DEGMM'( 6r   c           	     V   \         P                  ! R 4      ;_uu_ 4       p\        P                  P	                  R4      pVP                  VP                  R4      4       VP                  4        VP                  ^ 4       \        P                  ! \        P                  RV3V\        P                  R7      ;_uu_ 4       pVP                  4       w  rgRRR4       RRR4       V P                  XP!                  4       V4       R#   + '       g   i     L:; i  + '       g   i     LE; i)zwb+ASCIIr^   )r   rp   N)s   abcs   def)tempfileNamedTemporaryFiler   lineseprP   r   r@   r  seekra   rt   rN   r`   rs   ru   rj   r}   )r   r   r   r   sepr   rp   rq   s   &&&     r   check_inputCmdLineTest.check_input  s    ((//5**##G,CKK!123KKMJJqM!!t,JOO5 58<!%!1!1!35 0 	(3	5 5 0/s$   B!D D	DDDD(	c                *    V P                  R R4       R# )z-import sys; print(repr(sys.stdin.readline()))s   'abc\n'Nr5  r   s   &r   test_stdin_readlineCmdLineTest.test_stdin_readline  s     	;	r   c                *    V P                  R R4       R# )zprint(repr(input()))s   'abc'Nr8  r   s   &r   test_builtin_inputCmdLineTest.test_builtin_input  s    "	r   c                    R p\        RV4      w  r#p\        P                  R8X  d'   V P                  RV4       V P                  RV4       R# V P                  RV4       V P                  RV4       R# )zif 1:
            import sys
            print(1)
            print(2)
            print(3, file=sys.stderr)
            print(4, file=sys.stderr)r^   r   s   1
2
s   3
4
s   1
2
s   3
4
N)r	   rN   platformrj   r   r   r$   r%   r&   s   &    r   test_output_newlineCmdLineTest.test_output_newline  sg    ) (d3<<7"]C0]C0Y,Y,r   c                    \        R R4      w  rpV P                  VP                  RR4      R4       V P                  RV4       R# )r^   'r?   ignoreSyntaxErrorr   N)r
   r   rA   rj   rX   s   &   r   test_unmached_quoteCmdLineTest.test_unmached_quote  s?     -T37GX6Fc"r   c                    R p\        RV4      w  r#pV P                  RV4       V P                  ^xV4       V P                  RP                  R\        P
                  P                  4       4      V4       R# )zif 1:
            import os, sys, test.support
            test.support.SuppressCrashReport().__enter__()
            sys.stdout.write('x')
            os.close(sys.stdout.fileno())r^   r   s6   Exception ignored while flushing sys.stdout:
OSError: r    N)r
   rj   r.   replacer   r2  rP   r@  s   &    r   test_stdout_flush_at_shutdown)CmdLineTest.test_stdout_flush_at_shutdown  sh    -
 -T48c"b! ##*75"**2C2C2E#F	r   c                L    R p\        RV4      w  r#pV P                  RV4       R# )zimport sys; sys.stdout.close()r^   r   Nr  r@  s   &    r   test_closed_stdoutCmdLineTest.test_closed_stdout  s)     0'd3c"r   posixztest needs POSIX semanticsvxworksz.test needs preexec support in subprocess.Popenc                f  a R P                  SR7      pV3R lp\        P                  ! \        P                  RRV.\        P
                  \        P
                  \        P
                  VR7      pVP                  4       w  rVV P                  VR4       V P                  VP                  ^*4       R# )zif 1:
            import os, sys
            for i, s in enumerate({streams}):
                if getattr(sys, s) is not None:
                    os._exit(i + 1)
            os._exit(42)streamsc                     < R S 9   d   \         P                  ! ^ 4       RS 9   d   \         P                  ! ^4       RS 9   d   \         P                  ! ^4       R# R# )r   rp   rq   N)r   rv   rS  s   r   preexec+CmdLineTest._test_no_stdio.<locals>.preexec	  sA    '!7"7" #r   r]   r^   )r   rp   rq   
preexec_fnr   N)	formatra   rt   rN   r`   rs   ru   rj   r   )r   rT  r   rV  r   r%   r&   s   &f     r   _test_no_stdioCmdLineTest._test_no_stdio  s    
 #F7F3 		 ^^T4.//????  ==?c"r*r   c                *    V P                  R .4       R# )r   NrZ  r   s   &r   test_no_stdinCmdLineTest.test_no_stdin  s    WI&r   c                *    V P                  R .4       R# )rp   Nr]  r   s   &r   test_no_stdoutCmdLineTest.test_no_stdout      XJ'r   c                *    V P                  R .4       R# )rq   Nr]  r   s   &r   test_no_stderrCmdLineTest.test_no_stderr   rc  r   c                ,    V P                  . RO4       R# )r   N)r   rp   rq   r]  r   s   &r   test_no_std_streamsCmdLineTest.test_no_std_streams#  s    9:r   c                   V P                  R 4       . p\        P                  P                  RR4      R8w  d#   \	        \        P                  4      pVR RVR&   M/ p\        ^4       F8  pRp\        RV3/ VB w  rVpV P                  V^ 4       VP                  V4       K:  	  \        \        V4      4      pV P                  \        V4      ^RP                  V4      R7       R	p\        RVR
R7      w  rVpV P                  RV4       \        RVRR7      w  rVpV P                  RV4       \        RVRR7      w  rVpV P                  RV4       \        R RVRR7      w  rVpV P                  RV4       R# )z-RPYTHONHASHSEEDrandomr   
__cleanenvzprint(hash("spam"))r^   z83 runs produced an identical random hash  for "spam": {})msgz<import sys; print("random is", sys.flags.hash_randomization)r   rk  s   random is 1r   s   random is 0N)r'   r   r   getr   ranger	   rj   appendsortedsetassertGreaterr0   rY  r.   )r   hashesr   ir   r$   r%   r&   s   &       r   test_hash_randomization#CmdLineTest.test_hash_randomization&  s]   t$::>>*H5Arzz"C $% #CCqA(D+D$>#>LBSR#MM#	 
 F$3v; 117 	 	A
 N'd2Fnc*'d8Lnc*'d3Gnc*'dDMnc*r   c                   \         P                  pV P                  \         P                  V4       \	        VR RR7      ;_uu_ 4       p\        RVR7       \        RVR7       RRR4       \        V4       R#   + '       g   i     L; i)wr   r*  z
import sys)filezdel sys.modules['__main__']N)r   TESTFN
addCleanupunlinkopenprintr	   )r   filenamescripts   &  r   test_del___main__CmdLineTest.test_del___main__K  sa     ##	(((3(C'22f,V,/f= 3 	" 32s   A77B	c                |   \        R R4      w  rpV P                  RV4       V P                  VP                  4       P	                  R4      ^4       V P                  RV4       \        RR R7      w  rpV P                  RV4       V P                  VP                  4       P	                  R4      ^4       V P                  RV4       \        RRR R7      w  rpV P                  RV4       V P                  RV4       V P                  VP                  4       P	                  R4      ^4       V P                  RV4       R# )r]   z-zs   Unknown option: -zr   )withoutz-as   Unknown option: -aN)r
   r.   rj   r-   countr"   rX   s   &   r   test_unknown_options CmdLineTest.test_unknown_optionsV  s   ,T48+S1)//0EFJc" -T4@+S1)//0EFJc",T4F+S1.4)//0EFJc"r   6Cannot run -I tests when PYTHON env vars are required.c           
        V P                  R 4       V P                  R4       \        R RRRR7      w  rpV P                  VP                  4       R4       \        P
                  ! 4       ;_uu_ 4       p\        P                  P                  VR4      p\        P                  P                  VR4      p\        VR	R
R7      ;_uu_ 4       pVP                  R4       RRR4       \        VR	R
R7      ;_uu_ 4       pVP                  R4       VP                  R4       RRR4       V P                  \        P                  \        P                  \        P                   RV.V\        P"                  R7       \        P                  ! \        P                   R V.VR7      pV P                  VP                  4       R4       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)rz   z-IEPsr^   z`from sys import flags as f; print(f.no_user_site, f.ignore_environment, f.isolated, f.safe_path)r   )dummyvars
   1 1 1 Truezuuid.pyzmain.pyr{  r   r|  z)raise RuntimeError('isolated mode test')
Nzimport uuid
zprint('ok')
r]   )cwdrq   )r  s   ok)r'   r	   rj   stripr   temp_cwdr   r   r@   r  r   assertRaisesra   CalledProcessErrorrb   rN   r`   DEVNULL)r   r$   r%   r&   tmpdirfakemainfs   &       r   test_isolatedmodeCmdLineTest.test_isolatedmodei  sz    	t$w''dS 	
 	m4!!V77<<	2D77<<	2DdC'22aDE 3dC'22a(( 3 j;;(55"~~tT:%/%7%7  9 ))3>>4*F.46CSYY[%0 "! 3222 "!!s>   2AG.	G	G.9#G	B"G.GG.G+&G..G?	c                    R Fa  w  r\        VVVVR7      p\        \        V4      4      pRV RV R2pV P                  VR7      ;_uu_ 4        \	        RV3/ VB  RRR4       Kc  	  R#   + '       g   i     Kx  ; i)	r   )PYTHONDEBUGPYTHONOPTIMIZEPYTHONDONTWRITEBYTECODEPYTHONVERBOSEz|import sys; sys.stderr.write(str(sys.flags)); sys.exit(not (
                    sys.flags.optimize == sys.flags.verbose == zM
                    and sys.flags.debug == sys.flags.dont_write_bytecode == z
                )))envar_valuer^   N))r   r   )r   r>   )r   r>   )2rM   )r   intboolr   r	   )r   valuer   env_varsexpected_boolr   s   &     r   test_sys_flags_setCmdLineTest.test_sys_flags_set  s    IOE!$(-#	H  U,M@ AIz JMMZO \	  %00 t8x8 10!  J  100s   A**A;c           
        \        4       pRRRRRRVR 3.pV F  w  r4pVf   RMRV R2pRV R2pRV.pVf   / MRV/p	WAJ d	   R	R
.VR&   MVe   R	RV 2.VR&   V P                  W4R7      ;_uu_ 4        \        P                  ! 4       ;_uu_ 4        \	        V/ V	B  R R R 4       R R R 4       K  	  R #   + '       g   i     L; i  + '       g   i     K  ; i)Nfoozis Nonez== ""z,import sys; sys.exit(not sys.pycache_prefix r   r^   PYTHONPYCACHEPREFIXr{   pycache_prefix:Nr   Nzpycache_prefix=)envvalopt)NNN)r  Nr  )Nbarr  )r  r  r  )r  r   N)objectr   r   r  r	   )
r   NO_VALUEcasesr  r  r   
exp_clauser   rd   r   s
   &         r   test_set_pycache_prefix#CmdLineTest.test_set_pycache_prefix  s     8   !Hd#
 &+!F&.&6d8*A<NJA*QOD$<D"-BF,KC "23R OC5"9:RV55''))$d2c2 * 65 &+ *) 655s$   3CB3C3C>CCcheck_exitcodeTxdevc                  \        \        P                  4      pVP                  R R4       VP                  RR4       VP                  RR4       V'       d   \        P
                  RR.VO5pM\        P
                  .VO5p\        P                  ! V\        P                  \        P                  RVR7      pV'       d   V P                  VP                  ^ V4       VP                  P                  4       # )PYTHONWARNINGSNPYTHONDEVMODEPYTHONMALLOCr{   devTrp   rq   universal_newlinesr   )r   r   r   poprN   r`   ra   r   rs   r   rj   r   rp   r}   )r   r  r  rd   r   r   s   &$$*  r   run_xdevCmdLineTest.run_xdev  s    2:: $'&%NND%7$7DNN*T*D~~d%/__%/%6%615"%	'
 T__a6{{!!##r   c                   R pV P                  RVRR7      pV P                  VR4       V P                  RV4      pV P                  VR4       Rp\        P                  '       d   RpMRpV P                  RV4      pV P                  W#4       V P                  R	RV4      pV P                  VR
V 24       V P                  RRV4      pV P                  VRV 24       V P                  RRV4      pV P                  VRV 24        ^ RIpRp\        P
                  ! 4       ;_uu_ 4        V P                  RVRR7      pRRR4       \        P                  ! 4       '       d   RpM\        P                  '       d   RpMRpV P                  W%4        ^ RI	pRpV P                  RV4      pV P                  VR4       R#   + '       g   i     L; i  \         d     LMi ; i  \         d     R# i ; i)%import sys; print(sys.flags.dev_mode)r^   F)r  FalseTruez\import warnings; print(' '.join('%s::%s' % (f[0], f[2].__name__) for f in warnings.filters))zdefault::Warningzdefault::Warning default::DeprecationWarning ignore::DeprecationWarning ignore::PendingDeprecationWarning ignore::ImportWarning ignore::ResourceWarningz-bzdefault::BytesWarning -bbzerror::BytesWarning z-Werrorzerror::Warning NLimport _testinternalcapi; print(_testinternalcapi.pymem_getallocatorsname()))r  pymalloc_debugmimalloc_debugmalloc_debugz5import faulthandler; print(faulthandler.is_enabled()))
r  rj   r   r~   _testinternalcapiSuppressCrashReportwith_pymallocPy_GIL_DISABLEDImportErrorfaulthandler)r   r   r%   expected_filtersr  
alloc_namer  s   &      r   	test_xdevCmdLineTest.test_xdev  s    7mmD$Um3g&mmD$'f%> 1!: mmD$'/mmD$- 67G6HIJmmE4. 45E4FGHmmItT20@/ABC	.$ bD,,..mmD$umE /$$&&-
(((-
+
S-	* KD--d+CS&)% /.	  		"  		s0   G )F=G! =G	GG!G0/G0c                   V'       d   R pMRpVR,          p\         P                  RVRRV3p\        \        P                  4      pVP                  RR4       W&R&   \        P                  ! V\        P                  \        P                  R	VR
7      pV P                  VP                  ^ V4       VP                  P                  4       # )zimport sys; from test.support.import_helper import import_fresh_module; warnings = import_fresh_module('warnings', blocked=['_warnings']); zimport sys, warnings; zKprint(' '.join('%s::%s' % (f[0], f[2].__name__) for f in warnings.filters))-Wr  r^   r  Nr  Tr  )rN   r`   r   r   r   r  ra   r   rs   r   rj   r   rp   r}   )r   cmdline_optionenvvaruse_pywarningr   rd   r   r   s   &&&&    r   check_warnings_filters"CmdLineTest.check_warnings_filters  s    ZD ,D > 	?neT4H2::& &~~d%/__%/%6%615"%	'
 	!T2{{!!##r   c                    R p\         P                  '       g
   VR,          pV P                  RR4      pV P                  W!4       V P                  RRRR7      pV P                  W!4       R# )z9error::BytesWarning once::UserWarning always::UserWarningz default::DeprecationWarning ignore::DeprecationWarning ignore::PendingDeprecationWarning ignore::ImportWarning ignore::ResourceWarningzonce::UserWarningzalways::UserWarningT)r  N)r   r~   r  rj   )r   r  r%   s   &  r   test_warnings_filter_precedence+CmdLineTest.test_warnings_filter_precedence  s}    2  "; < ))*=*?A/))*=*?8< * > 	/r   c                   R p\        \        P                  4      pVP                  RR4       Ve   WR&   MVP                  RR4       \        P
                  RV3p\        P                  ! V\        P                  \        P                  RVR7      pV P                  VP                  P                  4       V4       V P                  VP                  ^ 4       R# )r  r  Nr  r^   Tr  )r   r   r   r  rN   r`   ra   r   rs   r   rj   rp   r}   r   )r   env_varnamer   r   rd   r   s   &&&    r   check_pythonmallocCmdLineTest.check_pythonmalloc/  s    ]2::&")GGND)d+~~d%/__%/%6%615"%	'
 	++-t4!,r   c                   \         P                  '       * p\         P                  ! 4       p\         P                  ! 4       p\         P                  '       d   \         P                  '       d   R MRpR pMAV'       d   \         P                  '       d   RMRpRpM\         P                  '       d   RMRpRpRV3RV3.pV'       d   VP                  R	R
.4       V'       d   VP                  R4       V'       d   VP                  R4       V F9  w  rxV P                  WxR7      ;_uu_ 4        V P                  Wx4       RRR4       K;  	  R#   + '       g   i     KP  ; i)r  mimallocr  pymallocr  mallocNdebug)r  r  )r  r  )r  r  ))r  r  )r  r  ))r  r  )r  r  )r   r  r  with_mimallocr~   rr   r   r  )	r   r  r  r  default_namedefault_name_debugr   r  r  s	   &        r   test_pythonmallocCmdLineTest.test_pythonmalloc@  s(    ,,,((*((*"""/6/?/?/?+ZL!1/6/?/?/?+ZL!1-4-=-=-=>8L!/ < ()
 LL$0  LL   LL  
 #MGg99''6 :9 #999s   *E

Ec                L   R p\        \        P                  4      pVP                  RR4       \        P
                  RV3p\        P                  ! V\        P                  RVR7      pV P                  VP                  P                  4       R4       V P                  VP                  ^ V4       RVR&   \        P                  ! V\        P                  RVR7      pV P                  VP                  P                  4       R4       V P                  VP                  ^ V4       R# )	r  r  Nr^   T)rp   r  r   r  r   r  )r   r   r   r  rN   r`   ra   r   rs   rj   rp   r}   r   )r   r   r   rd   r   s   &    r   test_pythondevmode_env"CmdLineTest.test_pythondevmode_envh  s    62::&d+~~d:??153@++-w7!T2"O~~d:??153@++-v6!T2r   c                   RR.p\         P                  '       d   VP                  . RO4       MVP                  RR.4       Rp\        \        P
                  4      pV EF  w  rErgV P                  WtVR7      ;_uu_ 4        VP                  RR4       Ve   WCR&   . pVe   RRV 2.p\        P                  ! \        P                  .VORNVN\        P                  \        P                  RVR	7      p	V P                  V	P                  ^ V	4       V P                  V	P                  P!                  4       V4       V P                  V	P"                  R
4       RRR4       EK  	  R#   + '       g   i     EK  ; i)r   Nz import sys; print(sys.flags.gil))r   r  
PYTHON_GILr{   zgil=r^   T)rp   rq   r   r   r   )r   Nr   zPYTHON_GIL=1)Nr   r   z-X gil=1))NNNonezno options set)r   Nr   zPYTHON_GIL=0)r   r   r   z-X gil=0 overrides PYTHON_GIL=1)Nr   r   z-X gil=0)NNr   z$-X gil=0 (unsupported by this build))r   Nr   z(PYTHON_GIL=0 (unsupported by this build))r   r  rr   r   r   r   r   r  ra   r   rN   r`   rs   rj   r   rp   r}   rq   )
r   r  r   r   r   r  r   rn  
extra_argsr   s
   &         r   test_python_gilCmdLineTest.test_python_gilz  sI    -(
 """LL LLMP 2rzz"',#Chc44L$/?,/L)
?"&$se!5J!~~s~~&O
&OD&O$&O-7__-7__+/W>   !T:  !3!3!5x@  b1 54 (-444s   CE''E9c                P    R p\        RVRR7      w  r#pV P                  RV4       R# )z;import asyncio; print(asyncio.new_event_loop().get_debug())r^   r   )PYTHONASYNCIODEBUGs   TrueNr	   r.   r@  s   &    r   test_python_asyncio_debug%CmdLineTest.test_python_asyncio_debug  s'    L'dsKgs#r   Py_TRACE_REFSz'Requires --with-trace-refs build optionc                    R p\         P                  ! 4       ;_uu_ 4        \         P                  ! R\        4       \	        RVRR7      w  r#pRRR4       V P                  X^ 4       R#   + '       g   i     L$; i)#import sys; sys._clear_type_cache()rE  r^   r   )PYTHONDUMPREFSN)warningscatch_warningssimplefilterDeprecationWarningr	   rj   r@  s   &    r   test_python_dump_refs!CmdLineTest.test_python_dump_refs  sY    4$$&&!!(,>?+D$sKLBS ' 	Q '&s   -A))A9	c           
     6   \         P                  ! 4       ;_uu_ 4       pR p\        P                  ! 4       ;_uu_ 4        \        P                  ! R\
        4       \        RW!P                  R7      w  r4pRRR4       V P                  X^ 4       \        VP                  R4      ;_uu_ 4       pVP                  4       pV P                  RV4       RRR4       RRR4       R#   + '       g   i     Lu; i  + '       g   i     L-; i  + '       g   i     R# ; i)r  rE  r^   )PYTHONDUMPREFSFILENrzRemaining objects)r0  r1  r  r  r  r  r	   r  rj   r  readr.   )r   	dump_filer   r$   r%   r&   r}  contentss   &       r   test_python_dump_refs_file&CmdLineTest.test_python_dump_refs_file  s    ((**i8D((**%%h0BC/d~~^ + R#innc**d99;18< + +* +* +* +**s:    D6C!	48D,#C4	D!C1,D4D?DD	z$PYTHONEXECUTABLE only works on macOSc                n    R pRp\        RWR7      w  r4pV P                  VP                  4       V4       R# )z!import sys; print(sys.executable)z/busr/bbin/bpythonr^   )PYTHONEXECUTABLENr	   r.   rP   r   r   r   r$   r%   r&   s   &     r   test_python_executable"CmdLineTest.test_python_executable  s1    2''dNhoo'-r   zTest only applicable on Windowsc                p    R pRp\        RVRR7      w  r4pV P                  VP                  4       V4       R# )z.import sys; print(sys.getfilesystemencoding())mbcsr^   r   )PYTHONLEGACYWINDOWSFSENCODINGNr  r  s   &     r   &test_python_legacy_windows_fs_encoding2CmdLineTest.test_python_legacy_windows_fs_encoding  s4    ?'dRUVhoo'-r   c                   R p\         P                  P                  4       pRVR&   \        P                  ! \
        P                  RV.\        P                  VR7      pV P                  VP                  ^ 4       RpRVR&   \        P                  ! \
        P                  RV.\        P                  VR7      pV P                  VP                  ^ 4       R# )zQimport sys; sys.exit(type(sys.stdout.buffer.raw).__name__ != '_WindowsConsoleIO')r   PYTHONLEGACYWINDOWSSTDIOr^   )creationflagsr   zFimport sys; sys.exit(type(sys.stdout.buffer.raw).__name__ != 'FileIO')r   N)
r   r   r   ra   r   rN   r`   CREATE_NEW_CONSOLErj   r   )r   r   r   r   s   &   r    test_python_legacy_windows_stdio,CmdLineTest.test_python_legacy_windows_stdio  s     cjjoo*,&'NNCNND$7)3)F)F"$ 	q) X*-&'NNCNND$7)3)F)F"$ 	q)r   z
-fsanitize	PY_CFLAGSz(PYTHONMALLOCSTATS doesn't work with ASANc                P    R p\        RVRR7      w  r#pV P                  RV4       R# )r   r^   r   )PYTHONMALLOCSTATSs   Small block thresholdNr  r@  s   &    r   test_python_malloc_stats$CmdLineTest.test_python_malloc_stats  s*     'dcJ.4r   c                n    R pRp\        RWR7      w  r4pV P                  VP                  4       V4       R# )z"import site; print(site.USER_BASE)z/custom/userbaser^   )PYTHONUSERBASENr  r  s   &     r   test_python_user_base!CmdLineTest.test_python_user_base  s1    3%'dLhoo'-r   c                p    R pRp\        RVRR7      w  r4pV P                  VP                  4       V4       R# )z3import os; print('PYTHON_BASIC_REPL' in os.environ)r  r^   r   )PYTHON_BASIC_REPLNr  r  s   &     r   test_python_basic_repl"CmdLineTest.test_python_basic_repl  s3    D'dcJhoo'-r   HAVE_PERF_TRAMPOLINEz%Requires HAVE_PERF_TRAMPOLINE supportc                p    R pRp\        RVRR7      w  r4pV P                  VP                  4       V4       R# )z3import sys; print(sys.is_stack_trampoline_active())r  r^   r   )PYTHON_PERF_JIT_SUPPORTNr  r  s   &     r   test_python_perf_jit_support(CmdLineTest.test_python_perf_jit_support  s3    D'dCPhoo'-r   z!bpo-32457 only applies on Windowsc                   \         P                  R R3p\        P                  P	                  \         P                  4      w  r#VR,           V,           p\
        P                  ! V\
        P                  VR7      pV P                  VP                  ^ V4       V P                  VP                  P                  4       R4       R# )r^   zprint(0)z\.\.\.\)rp   r`      0N)rN   r`   r   r   splitra   r   rs   rj   r   rp   r  )r   rd   prefixexer`   r   s   &     r   test_argv0_normalization$CmdLineTest.test_argv0_normalization  s     ~~tZ/ggmmCNN3m+c1
~~d:??)35!T2**,d3r   c                   \         P                  R R.p\        P                  ! V\        P                  \        P                  RR7      pRpV P                  VP                  V4       V P                  VP                  ^ 4       R# )rz   z--unknown-optionT)rp   rq   r   z(Unknown option: --unknown-option
usage: N)	rN   r`   ra   r   rs   rR   rq   assertNotEqualr   )r   rd   r   err_msgs   &   r   test_parsing_errorCmdLineTest.test_parsing_error  sc    &89~~d%/__%/__#') >dkk73DOOQ/r   c                   R p\        RRRV4       \        RRRV4       \        RRRV4       \        RRRVRR7       \        RVRR7       \        RVR	R7       \        RV4      pV P                  p\        P                  ! 4       pV P                  V! V4      WD34       \        RR
RV4      pV P                  V! V4      R4       \        RRRV4      pV P                  V! V4      R4       \        RRRV4      pV P                  V! V4      R4       \        RVRR7      pV P                  V! V4      R4       \        RVRR7      pV P                  V! V4      R4       \        RRRVRR7      pV P                  V! V4      R4       R# )zMimport sys; print(sys.flags.int_max_str_digits, sys.get_int_max_str_digits())r{   int_max_str_digitsr^   zint_max_str_digits=foozint_max_str_digits=1004000)PYTHONINTMAXSTRDIGITSr  100zint_max_str_digits=0zint_max_str_digits=4000zint_max_str_digits=100000r   zint_max_str_digits=6000N)r   r   )  rC  )順 rD  )p  rE  )r
   r	   res2intrN   get_int_max_str_digitsrj   )r   r   r   rF  current_maxs   &    r   test_int_max_str_digits#CmdLineTest.test_int_max_str_digits  s}   ^d$8$Ed$<dDId$<dDId$8$4:	< 	dDFdDFtT*,,002'ABt%;T4Hv.t%>dK|4t%@$M'78tTEv.tTH|4+T4"(
 	|4r   c                8   R\        R4      P                  RR4      R3\        R4      P                  RR4      R3RP                  R	R
4      R3RR.pV EFB  w  r#\        P                  RV3p\        P
                  ! V\        P                  R7      pV P                  VP                  ^ V4       VP                  P                  4       P                  RR7      p\        P                  R\        V4      3p\        P
                  ! V\        P                  R7      pV P                  VP                  ^ V4       VP                  P                  4       P                  RR7      p	V P                  Wi4       V P                  VP                  RR4      V4       EKE  	  R# )@
                    print('space-auto-dedent')
                z=
                ^^^print('tab-auto-dedent')
                ^	ztab-auto-dedentz
                ^^if 1:
                ^^^^print('mixed-auto-dedent-1')
                ^^print('mixed-auto-dedent-2')
                z	 	z'mixed-auto-dedent-1
mixed-auto-dedent-2a#  
                    data = """$

                    this data has an empty newline above and a newline with spaces below $
                                            $
                    """$
                    if 1:         $
                        print(repr(data))$
                $r   zO'\n\nthis data has an empty newline above and a newline with spaces below \n\n'r^   )rp   r   r|  z

N)rL  zspace-auto-dedent)r   r   )z  	
	
 			  		 	
		 


			   r   )r   rJ  rN   r`   ra   r   rs   rj   r   rp   r  rA   )
r   
test_casesr   r   args1proc1output1args2proc2output2s
   &         r   test_cmd_dedentCmdLineTest.test_cmd_dedent7  sz     '#t$!  '#w':	 G f"]2

f )NDNND$.ENN5AEU--q%8ll((*1171CG NND&,6ENN5AEU--q%8ll((*1171CGW.W__VT:HE )r   c                    ^ RI Hp V! R4      pVP                  RR4      P                  RR4      p\        RV4       VP                  RR4      P                  RR4      p\        RV4       R# )	r   r   zE
            -+if 1:
            +-++ print('will fail')
            - +rN  r^   N)r  r   rJ  r
   )r   r   templater   s   &   r   test_cmd_dedent_failcase$CmdLineTest.test_cmd_dedent_failcase|  sh    #
 S)11#t<dD)T*223<dD)r   c                    R p\        RRRV4      pV P                  V P                  V4      R4       \        RVRR7      pV P                  V P                  V4      R4       R# )	8import os; print(os.cpu_count(), os.process_cpu_count())r{   zcpu_count=4321r^   1234PYTHON_CPU_COUNTN)  rf  )  rg  )r	   rj   rF  r   r   r   s   &  r   test_cpu_countCmdLineTest.test_cpu_count  sX    It%5tTBc*L9tTFCc*L9r   c                   R p\        RRRV4      pV P                  V P                  V4      \        P                  ! 4       \        P
                  ! 4       34       \        RRRVRR7      pV P                  V P                  V4      \        P                  ! 4       \        P
                  ! 4       34       \        RVRR7      pV P                  V P                  V4      \        P                  ! 4       \        P
                  ! 4       34       R# )rb  r{   zcpu_count=defaultr^   rc  rd  defaultN)r	   rj   rF  r   	cpu_countprocess_cpu_countrh  s   &  r   test_cpu_count_default"CmdLineTest.test_cpu_count_default  s    It%8$Ec*R\\^R=Q=Q=S,TUt%8$W]^c*R\\^R=Q=Q=S,TUtTIFc*R\\^R=Q=Q=S,TUr   c                   R pR
 FP  p\        RVRV4      pVP                  P                  R4      pV P                  VR4       V P	                  VR4       KR  	  \        RRRV4      pVP                  P                  R4      pV P                  VR4       V P                  VR4       \        RRRV4       \        RRRV4       R	# )zimport os; import osr{   r^   r   z&import time: \s*\d+ \| \s*\d+ \| \s*osz)import time: cached\s* \| cached\s* \| oszimporttime=2zimporttime=-1zimporttime=3N)
importtimezimporttime=1zimporttime=true)r	   r&   rA   r   assertNotRegexr
   )r   r   caser   res_errs   &    r   test_import_timeCmdLineTest.test_import_time  s    %CD"4tT:CggnnW-GW&OP)UV	 D t^T4@''..)"KL"NOdOT4@dND$?r   c                    VP                   P                  4       P                  R 4      p\        ;QJ d"    . R VP	                  4        4       F  NK  	  5# ! R VP	                  4        4       4      # )r   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   )r  ).0rw  s   & r   	<genexpr>&CmdLineTest.res2int.<locals>.<genexpr>  s     1[SVV[s   )r%   r  rA   tupler4  )r   r   r%   s   && r   rF  CmdLineTest.res2int  sJ    ggmmo$$W-u1SYY[1u1u1SYY[111r   z@PYTHON_TLBC and -X tlbc only supported in Py_GIL_DISABLED buildsc                J    R p\        RRRRRV4       \        RRRVRR7       R# )	if 1:
            import threading
            def test(x, y):
                return x + y
            t = threading.Thread(target=test, args=(1,2))
            t.start()
            t.join()r  alwaysr{   ztlbc=0r^   r   PYTHON_TLBCNr	   r   r   s   & r   "test_disable_thread_local_bytecode.CmdLineTest.test_disable_thread_local_bytecode  s-    
 	xxtDxtEr   c                J    R p\        RRRRRV4       \        RRRVRR7       R# )	r  r  r  r{   ztlbc=1r^   r   r  Nr  r  s   & r   !test_enable_thread_local_bytecode-CmdLineTest.test_enable_thread_local_bytecode  s-    
 	xxtDxtEr   c                   \        R R4      w  rpV P                  RV4       \        R R4      w  rpV P                  RV4       \        R R4      w  rpV P                  RV4       \        R R4      w  rpV P                  RV4       \        RR7      w  rpV P                  RV4       \        R	R7      w  rpV P                  RV4       \        R
R7      w  rpV P                  RV4       R# )r{   tlbcs   tlbc=n: n is missing or invalidztlbc=fooztlbc=-1ztlbc=2r  r  s&   PYTHON_TLBC=N: N is missing or invalidz-1r  N)r
   r.   rX   s   &   r   "test_invalid_thread_local_bytecode.CmdLineTest.test_invalid_thread_local_bytecode  s     -T6:8#>,T:>8#>,T9=8#>,T8<8#>,??E,>?E,=?Er    N)F)k__name__
__module____qualname____firstlineno__r   r'   r   cpython_onlyr3   r8   r;   rB   rF   rJ   rU   rY   r   skipIfr   rk   r   r   r   r   r   r   r   
skipUnlessr   r   r   r   rN   r?  r   r   
is_androidr   r   r   rp  r  r
  r  r  flags	safe_pathr$  r,  r5  r9  r<  rA  rG  rK  rN  r  rZ  r^  ra  re  rh  rx  r  r  r  r  r  r  r  r  r  r  r  r  r  r  	sysconfigget_config_varr  r  r  
MS_WINDOWSr  r  get_config_varsr#  r'  r+  r0  r7  r<  rI  rX  r_  ri  ro  rv  rF  r  r   requires_working_threadingr  r  r  __static_attributes____classdictcell____classdict__s   @r   r   r   #   sC    % ( ( * * & & 	, 	,&% 0 01 __57MO:O: '> D D 	D 	D
4	<I' ..0LM( N( ..0LMF NF __S\\W,79Q9QB __S\\W,79(G9(GT #,,(2 # #""%LN*N*( __RZZ^^$6<C:</</L *2 __SYY((>@%@%")$
4-"## __RWW')EF__S\\Y.IK+K G+0'((;#+J	# # #$ __57MO1O149*34$T $ $& ;* ;*z$*0*-" %7 %7N3$)2V$
 11/BDmn  o  11/BDmn
= o
= 13YZ. [. ++-NO. P. ++-NO* P** __\Y%>%>%@%D%D[RT%UU?A5A5
.. 112HIKrs. t. 0<>4>4 0 05BCFJ*:V@$2 00EF 002	F 3F	F 00EF 002F 3FF 00EFFFFr   r   r  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )IgnoreEnvironmentTesti  c                @    R P                  V4      p\        RRV3/ VB # )z@import sys; sys.stderr.write(str(sys.flags)); sys.exit(not ({}))r]   r^   )rY  r	   )r   	predicater  r   s   &&, r   run_ignoring_vars'IgnoreEnvironmentTest.run_ignoring_vars  s*    
 RXXYbcdD=H==r   c                N    R pV P                  RP                  V4      VR7       R# )should_be_ignoredz'{}' not in sys.pathr  N)r  rY  )r   r   s   & r   test_ignore_PYTHONPATH,IgnoreEnvironmentTest.test_ignore_PYTHONPATH  s+    "5<<TB*. 	 	0r   c                ,    V P                  R RR7       R# )z!sys.flags.hash_randomization == 1r   ro  Nr  r   s   &r   test_ignore_PYTHONHASHSEED0IgnoreEnvironmentTest.test_ignore_PYTHONHASHSEED  s    B.1 	 	3r   c           	     8    R pV P                  VRRRRRR7       R# )z
            (sys.flags.debug == sys.flags.optimize ==
             sys.flags.dont_write_bytecode ==
             sys.flags.verbose == sys.flags.safe_path == 0)
        r   )r  r  r  r  PYTHONSAFEPATHNr  )r   expected_outcomes   & r   test_sys_flags_not_set,IgnoreEnvironmentTest.test_sys_flags_not_set  s1    
 	$' 	 	
r   r  N)
r  r  r  r  r  r  r  r  r  r  r  s   @r   r  r    s     >0
3
 
r   r  c                   <   a  ] tR tRt o ]R 4       tR tR tRtV t	R# )SyntaxErrorTestsi	  c                :   \         P                  ! \        P                  R .V\         P                  \         P                  R7      pV P                  VP                  ^ 4       V P                  VP                  R4       V P                  RVP                  4       R# )r[  )inputrp   rq   Ns   
SyntaxError)	ra   r   rN   r`   rs   r:  r   rq   r.   )r   r   r   s   && r   check_stringSyntaxErrorTests.check_string
  sf    ~~s~~s34%/__Z__NDOOQ/DKK.&4r   c                (    V P                  R 4       R# )s   (1+2+3Nr  r   s   &r   test_tokenizer_error_with_stdin0SyntaxErrorTests.test_tokenizer_error_with_stdin  s    )$r   c                (    V P                  R 4       R# )s   '\u1f'Nr  r   s   &r   *test_decoding_error_at_the_end_of_the_line;SyntaxErrorTests.test_decoding_error_at_the_end_of_the_line  s    *%r   r  N)
r  r  r  r  r   r  r  r  r  r  r  s   @r   r  r  	  s&     5 5%& &r   r  c                  0    \         P                  ! 4        R # r   )r   reap_childrenr  r   r   tearDownModuler    s    r   __main__) r   ra   rN   r  r0  r  r   r  r   r   test.supportr   r   r   test.support.script_helperr   r   r	   r
   r   r   has_subprocess_supportSkipTestr   TestCaser   r  r  r  r  r  r  r  r   r   <module>r     s   
 
  
       " , )   %%%


=
>>}F(## }F@& 
13IK!
H-- !
K!
H&x(( &  zMMO r   