+
    BiV                        ^ 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R.tRtRtRtRt. R&Ot]P$                  R	8X  d   R
tR
tM]	P&                  ! 4       '       d   R.tRtR
tRtMc]P$                  P+                  R4      '       d   RtRtM=]P$                  R8X  d   R
tM)]P$                  R8X  d   RtM]P$                  R8X  d   R
tR
t]P$                  P+                  R4      '       d   ]P-                  R4       R&t]! ]P$                  R'9  ;'       d    ]! ] R4      ;'       d
    ]! ] R4      4      tR tRt]! R]4      t ! R R]4      tRtRt Rs!Rs"Rs#R t$ ! R R]PJ                  4      t& ! R R]&4      t']	PP                  ]PR                  ! ]PT                  ! R 4      R!4       ! R" R#]&4      4       4       t+R$ t,]-R%8X  d   ]P\                  ! 4        R# R# )(    N)
namedtuple)support)run_python_until_endCzinvalid.asciiasciiTandroidutf-8Faixz	iso8859-1darwincygwinvxworkslinuxPOSIXnl_langinfoCODESETc                     R p\         '       d
   VR,          pVP                  V 4      p\        RVRR7      w  r4VP                  ^ 8H  # )z=import locale; print(locale.setlocale(locale.LC_CTYPE, '{}'))z>; import sys; sys.exit(not locale.nl_langinfo(locale.CODESET))-c PYTHONCOERCECLOCALE)_check_nl_langinfo_CODESETformatr   rc)locale_namecmd_fmtcmdresultpy_cmds   &    2/usr/lib/python3.14/test/test_c_locale_coercion.py_set_locale_in_subprocessr    ^   sD    MG!!SS
..
%C)$LNF99>    zBfsencoding stdin_info stdout_info stderr_info lang lc_ctype lc_allEncodingDetailsc                   f   a  ] tR t^lt o RP	                  . RO4      t]R 4       t]R 4       tRt	V t
R# )r"   ;c                j   VR ,           pVf   RpVP                  V4      .^,          pVP                  VP                  R4      4       VP                  RR4      pV'       d   \        p	MVP                  RR4      p	VP                  RR4      p
WV
3p\	        V ! V.VOVO5!  P                  4       4      # )z:{}surrogateescapebackslashreplaceLANGznot setLC_CTYPELC_ALL)r   appendgetCLI_COERCION_TARGETdict_asdict)clscoercion_expectedfs_encodingstream_encodingstream_errorsenv_vars_streamstream_infoexpected_langexpected_lc_ctypeexpected_lc_allenv_infos   &&&&&&      r   get_expected_details$EncodingDetails.get_expected_detailsy   s     "E)  .M~~m459 	7>>*<=> VY7 3 (Z C",,x; _DC=k=H=EEGHHr!   c                |   \        R RRV P                  3/ VB w  r#VP                  ^ 8X  g   VP                  V4       VP                  P                  R4      P                  4       p\        V ! V!  P                  4       4      pVP                  P                  R4      P                  4       P                  4       pWV3# )z-Xzutf8=0r   r   )r   CHILD_PROCESS_SCRIPTr   failoutdecode
splitlinesr.   r/   errrstrip)r0   r5   r   r   stdout_lineschild_encoding_detailsstderr_liness   &&     r   get_child_details!EncodingDetails.get_child_details   s     .(D#":":

 yyA~KKzz((1<<>!%c<&8&@&@&B!Czz((188:EEG%33r!    N)zimport sys, osz"print(sys.getfilesystemencoding())z2print(sys.stdin.encoding + ':' + sys.stdin.errors)z4print(sys.stdout.encoding + ':' + sys.stdout.errors)z4print(sys.stderr.encoding + ':' + sys.stderr.errors)z(print(os.environ.get('LANG', 'not set'))z,print(os.environ.get('LC_CTYPE', 'not set'))z*print(os.environ.get('LC_ALL', 'not set')))__name__
__module____qualname____firstlineno__joinr?   classmethodr<   rI   __static_attributes____classdictcell____classdict__s   @r   r"   r"   l   sC     88 	% 	 I I* 4 4r!   zPython runtime initialized with LC_CTYPE=C (a locale with default ASCII encoding), which may cause Unicode compatibility problems. Using C.UTF-8, C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is recommended.zPython detected LC_CTYPE=C: LC_CTYPE coerced to {} (set another locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).c                  &   \         e   R # . s \         F+  p \        V 4      '       g   K  \         P                  V 4       K-  	  \         '       d'   \         ^ ,          s\
        P                  \        4      s\        P                  '       d   \        R\         : 24       \        R\        : 24       \        R\        : 24       \        R\        : 24       \        R\        : 24       \        R\        : 24       \        R\        : 24       R # R # )NzAVAILABLE_TARGETS = z EXPECTED_C_LOCALE_EQUIVALENTS = z$EXPECTED_C_LOCALE_STREAM_ENCODING = z EXPECTED_C_LOCALE_FS_ENCODING = z$EXPECT_COERCION_IN_DEFAULT_LOCALE = z_C_UTF8_LOCALES = z_check_nl_langinfo_CODESET = )AVAILABLE_TARGETS_C_UTF8_LOCALESr    r+   r-   CLI_COERCION_WARNING_FMTr   CLI_COERCION_WARNINGr   verboseprintEXPECTED_C_LOCALE_EQUIVALENTS!EXPECTED_C_LOCALE_STREAM_ENCODINGEXPECTED_C_LOCALE_FS_ENCODING!EXPECT_COERCION_IN_DEFAULT_LOCALEr   )target_locales    r   setUpModulerb      s    
 $ )$]33$$]3 ) /27>>?RS$%6$9:;01N0QRS45V4YZ[01N0QRS45V4YZ["?"567-.H-KLM r!   c                   &   a  ] tR t^t o R tRtV tR# )_LocaleHandlingTestCasec                    \         P                  V4      pVw  r\         P                  VVVVV4      p
V P                  W4       Vf   . pV P                  W4       R # N)r"   rI   r<   assertEqual)selfr5   expected_fs_encodingexpected_stream_encodingexpected_stream_errorsexpected_warningsr1   r   encoding_detailsrH   expected_detailss   &&&&&&&    r   _check_child_encoding_details5_LocaleHandlingTestCase._check_child_encoding_details   sh     !228<)/&*?? $"
 	)<$ "9r!   rK   N)rL   rM   rN   rO   ro   rR   rS   rT   s   @r   rd   rd      s     : :r!   rd   c                   <   a  ] tR t^t o ]R 4       tR tR tRtV t	R# )LocaleConfigurationTestsc                J    \         '       g   \        P                  ! R 4      hR# )z No C-with-UTF-8 locale availableN)rW   unittestSkipTest)r0   s   &r   
setUpClass#LocaleConfigurationTests.setUpClass   s!     ! ##$FGG !r!   c                F   R V n         RpRpRRRRRRRRRR/pR Fo  p\         Fb  pVR8X  d
   VR8X  d   K  V P                  VVR	7      ;_uu_ 4        VP                  4       pWVV&   V P	                  VVVR R R
R7       R R R 4       Kd  	  Kq  	  R #   + '       g   i     K}  ; i)Nr	   r(   r   r)   r*   r   PYTHONIOENCODINGUTF-8env_varconfigured_localeFrk   rl   r1   r(   r)   maxDiffrW   subTestcopyro   rh   ri   rj   base_var_dictr|   locale_to_setvar_dicts   &      r   )test_external_target_locale_configurationBLocaleConfigurationTests.test_external_target_locale_configuration  s     &#*  Bb!2
 ,G!2 f$')A\\'4A " C C,113H(5W%66x7K7ONRIMIN 7 P	C C "3 ,C C C   ,B	B c                F   R V n         RpRpRRRRRRRRRR/pR Fo  p\         Fb  pVR8X  d
   VR8X  d   K  V P                  VVR	7      ;_uu_ 4        VP                  4       pWVV&   V P	                  VVVR
R RR7       R R R 4       Kd  	  Kq  	  R #   + '       g   i     K}  ; i)Nr	   r(   r   r)   r*   r   ry   rz   r{   strictFr~   r   r   r   s   &      r   test_with_ioencoding-LocaleConfigurationTests.test_with_ioencoding&  s     &#*  Bb!2
 ,G!2 f$')A\\'4A " C C,113H(5W%66x7K7ONVIMIN 7 P	C C "3 ,C C Cr   r   N)
rL   rM   rN   rO   rQ   rv   r   r   rR   rS   rT   s   @r   rr   rr      s.      H H!PF P  Pr!   rr   PY_COERCE_C_LOCALEz(C locale coercion disabled at build timec                   N   a  ] tR tRt o RR ltR tR tR tR tR t	R	 t
R
tV tR# )LocaleCoercionTestsiH  Nc                   R V n         \        '       g   \        p\        pRpV'       d   \        .pRRRRRRRRRR/pVP                  V4       Ve   W7R&   TpTp	\        '       g   RV9  d   \        ;rV P                  RVR	7      ;_uu_ 4        \        '       g   \        '       g   RV9   d   Tp
TpMR p
Rp\        P                  '       d   V
\        .8X  d   R p
V P                  VVV	R V
V4       R R R 4       \         F\  pR FS  pV P                  VVVRR
7      ;_uu_ 4        VP                  4       pWV&   V P                  VVVR VV4       R R R 4       KU  	  K^  	  R #   + '       g   i     Lx; i  + '       g   i     K  ; i)NFr(   r   r)   r*   r   ry   T)default_localer   )r|   nominal_localer   ry   r   )r   rW   r_   r^   LEGACY_LOCALE_WARNINGupdateDEFAULT_LOCALE_IS_CDEFAULT_ENCODINGr   r`   r   
is_androidrZ   ro   r]   r   )rh   r2   r3   coerce_c_localerl   r1   
extra_varsr   _fs_encoding_stream_encoding_expected_warnings_coercion_expectedr   r|   r   s   &&&&&&,        r   _check_c_locale_coercion,LocaleCoercionTests._check_c_locale_coercionN  s   "   7K?O % %:$;! Bb!2
 	Z(&3B/0 #*""xz'A.>>L\\.=  ? ?11//H
4J%6"%6"%)"%*"
 """&+?*@@%)"..}/;/?/3/A/AC!?0 ;M/\\'1>6E35 " 7 7  -113H(5W%66x7B7F7;7H7HJ7 7 0 ;1? ?47 7 7s$   E"(%E"$E"%+E5	"E2	5Fc                .    V P                  R R RR7       R# )r	   Nr   r   rh   s   &r    test_PYTHONCOERCECLOCALE_not_set4LocaleCoercionTests.test_PYTHONCOERCECLOCALE_not_set  s    %%gw%Mr!   c                @    R F  pV P                  RRVR7       K  	  R# )r   r	   r   N)r   1truefalser   )rh   settings   & r   !test_PYTHONCOERCECLOCALE_not_zero5LocaleCoercionTests.test_PYTHONCOERCECLOCALE_not_zero  s#     2G))'7G)T 2r!   c                :    V P                  R R R\        .R7       R# )r	   warn)r   rl   N)r   rZ   r   s   &r   $test_PYTHONCOERCECLOCALE_set_to_warn8LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_warn  s#    %%gw6<9M8N 	& 	Pr!   c                |    V P                  \        \        R RR7       V P                  \        \        R RRR7       R# )0F)r   r1   r   r   r*   r1   N)r   r_   r^   r   s   &r   $test_PYTHONCOERCECLOCALE_set_to_zero8LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_zero  sE    %%&C&G698= 	& 	?
 	%%&C&G69-08=	 	& 	?r!   c           	         V P                  \        \        R RRR7       V P                  \        \        RR\        .RR7       R # )Nr   Fr   r   )r   r*   rl   r1   )r   r_   r^   r   r   s   &r   test_LC_ALL_set_to_C(LocaleCoercionTests.test_LC_ALL_set_to_C  sN    %%&C&G6:-08=	 	& 	? 	%%&C&G6<-09N8O8= 	& 	?r!   c                   \         P                  ! \         P                  R 4      pV P                  \         P                  \         P                  V4        \         P                  ! \         P                  R4      pXR8X  d   V P                  R4       V\        9   d   V P                  RV,          4       Rp\        \        P                  RR7      p\        P                  ! \        P                  RV.\        P                  VR	R
7      pV P!                  VP"                  P%                  4       V4       R #   \         P                   d%   pT P                  \        T4      4        R p?LR p?ii ; i)Nr   r   z.test requires LC_CTYPE locale different than Czcoerced LC_CTYPE locale: %sz=import locale; print(locale.setlocale(locale.LC_CTYPE, None))r   r   r   T)stdoutenvtext)locale	setlocaler)   
addCleanupErrorskipTeststrTARGET_LOCALESr.   osenviron
subprocessrunsys
executablePIPErg   r   rE   )rh   old_loclocecoder   r   s   &      r   #test_PYTHONCOERCECLOCALE_set_to_one7LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_one  s   ""6??D9((&//7C	"""6??B7C #:MMJK. MM7#=> O2::37nncnndD9$.OO!$"&( 	**,c2 || 	"MM#a&!!	"s   %D8 8E1E,,E1r   )NT)rL   rM   rN   rO   r   r   r   r   r   r   r   rR   rS   rT   s   @r   r   r   H  s3     QJfNUP??3 3r!   r   c                  0    \         P                  ! 4        R # rf   )r   reap_childrenrK   r!   r   tearDownModuler     s    r!   __main__)zC.UTF-8zC.utf8rz   )r   r   )/r   r   r   r   	sysconfigrt   collectionsr   testr   test.support.script_helperr   r]   r^   r_   r   r`   r   platformlinked_to_muslr   
startswithr+   rX   boolhasattrr   r    _fields_EncodingDetailsr"   r   rY   rW   r-   rZ   rb   TestCaserd   rr   cpython_only
skipUnlessget_config_varr   r   rL   mainrK   r!   r   <module>r      sF    	  
   "  ; "%o 6  %, ! '   $( !/ <<9(/%$+!%(E!(-%\\U##(3%$/!\\X$+!\\X ).%\\Y(/%$+!<<7## "((1 1 "LL++  FM" FI  O/9 94& 94| J     N<:h// :@MP6 MP^ 		Y--.BC?AX31 X3A X3v zMMO r!   