HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/test/__pycache__/test_c_locale_coercion.cpython-311.opt-2.pyc
�

��VccM��(�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddgZdZ
dZdZgd	�Zej�d
��r"e	jrdZ
dZn`e�d��nJej�d
��rdZ
dZn+ejdkrdZnejdkrdZnejdkrdZ
dZd	Zeejdvoeed��oeed����Zd�ZdZede��ZGd�de��ZdZdZdada da!d�Z"Gd�dej#��Z$Gd�d e$��Z%e	j&ej'ej(d!��d"��Gd#�d$e$������Z)d%�Z*e+d&krej,��dSdS)'�N)�
namedtuple)�support)�run_python_until_end�Cz
invalid.ascii�asciiT)zC.UTF-8zC.utf8�UTF-8�linux�utf-8�POSIX�aixz	iso8859-1�darwin�cygwinF�vxworks)r
r	�nl_langinfo�CODESETc��d}tr|dz
}|�|��}td|d���\}}|jdkS)Nz=import locale; print(locale.setlocale(locale.LC_CTYPE, '{}'))z>; import sys; sys.exit(not locale.nl_langinfo(locale.CODESET))�-c���PYTHONCOERCECLOCALEr)�_check_nl_langinfo_CODESET�formatr�rc)�locale_name�cmd_fmt�cmd�result�py_cmds     �/D:\Python311\Lib\test\test_c_locale_coercion.py�_set_locale_in_subprocessr WsP��M�G�!�T��S�S��
�.�.��
%�
%�C�)�$���L�L�L�N�F�F��9��>��zBfsencoding stdin_info stdout_info stderr_info lang lc_ctype lc_all�EncodingDetailsc�h�eZdZd�gd���Zed���Zed���ZdS)r"�;)zimport 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'))c��	|dz}d|�d��gz}|�|�d����|�dd��}|rt}n|�dd��}|�dd��}	|||	f}
t	||g|�|
�R������S)	Nz:{}��surrogateescape�backslashreplace�LANGznot set�LC_CTYPE�LC_ALL)r�append�get�CLI_COERCION_TARGET�dict�_asdict)�cls�coercion_expected�fs_encoding�stream_encoding�env_vars�_stream�stream_info�
expected_lang�expected_lc_ctype�expected_lc_all�env_infos           r�get_expected_detailsz$EncodingDetails.get_expected_detailsrs���I�!�E�)������(9�:�:�;�;�����7�>�>�*<�=�=�>�>�>� ���V�Y�7�7�
��	D� 3��� (���Z�� C� C��"�,�,�x��;�;�� �"3�_�D���C�C��=�k�=�H�=�=�=�E�E�G�G�H�H�Hr!c��	tddd|jfi|��\}}|jdks|�|��|j�d�����}t||������}|j	�d���
�����}||fS)Nz-Xzutf8=0rrr)r�CHILD_PROCESS_SCRIPTr�fail�out�decode�
splitlinesr/r0�err�rstrip)r1r5rr�stdout_lines�child_encoding_details�stderr_liness       r�get_child_detailsz!EncodingDetails.get_child_details�s���		�.��(�D�#�":�
�
��
�
�����y�A�~�	 ��K�K������z�(�(��1�1�<�<�>�>��!%�c�c�<�&8�&@�&@�&B�&B�!C�!C���z�(�(��1�1�8�8�:�:�E�E�G�G��%�|�3�3r!N)�__name__�
__module__�__qualname__�joinr>�classmethodr<rH�r!rr"r"esp�������8�8�	%�	%�	%�	�	���I�I��[�I�"�4�4��[�4�4�4r!z�Python 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.z�Python detected LC_CTYPE=C: LC_CTYPE coerced to {} (set another locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).c�F�t�dSgatD]+}t|��rt�|���,tr,tdat
�t��atj	r�tdt����tdt����tdt����tdt����tdt����tdt����tdt����dSdS)	NrzAVAILABLE_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�setUpModuler[�s:��
������)�4�4�
�$�]�3�3�	4��$�$�]�3�3�3���T�/��2��7�>�>�?R�S�S����N�
�:�%6�:�:�;�;�;�
�R�1N�R�R�S�S�S�
�Z�5V�Z�Z�[�[�[�
�R�1N�R�R�S�S�S�
�Z�5V�Z�Z�[�[�[�
�6�?�6�6�7�7�7�
�L�.H�L�L�M�M�M�M�M�N�Nr!c��eZdZd�ZdS)�_LocaleHandlingTestCasec���	t�|��}|\}}t�||||��}	|�||	��|�g}|�||��dS�N)r"rHr<�assertEqual)
�selfr5�expected_fs_encoding�expected_stream_encoding�expected_warningsr2r�encoding_detailsrG�expected_detailss
          r�_check_child_encoding_detailsz5_LocaleHandlingTestCase._check_child_encoding_details�s���	�!�2�2�8�<�<��)/�&��,�*�?�?�� �$��	
�
��	
���)�+;�<�<�<��	#� "������'8�9�9�9�9�9r!N)rIrJrKrgrNr!rr]r]�s#������:�:�:�:�:r!r]c�*�eZdZed���Zd�ZdS)�LocaleConfigurationTestsc�<�tstjd���dS)Nz No C-with-UTF-8 locale available)rP�unittest�SkipTest)r1s r�
setUpClassz#LocaleConfigurationTests.setUpClass�s+��!�	H��#�$F�G�G�G�	H�	Hr!c
�&�d|_d}d}ddddd�}dD]{}tD]q}|dkr|dkr�|�||���5|���}|||<|�|||dd�	��ddd��n#1swxYwY�r�|dS)
Nr
r�r)r*r+r�r)r*r)r)�env_var�configured_localeF)rdr2)�maxDiffrP�subTest�copyrg)rarbrc�
base_var_dictrq�
locale_to_set�var_dicts       r�)test_external_target_locale_configurationzBLocaleConfigurationTests.test_external_target_locale_configuration�sU�����&��#*� ����#%�	
�
�
�,�	P�	P�G�!2�
P�
P�
��f�$���'�)A����\�\�'�4A�"�C�C�P�P�,�1�1�3�3�H�(5�H�W�%��6�6�x�7K�7O�IM�IN�	7�P�P�P�	P�P�P�P�P�P�P�P�P�P�P����P�P�P�P��
P�	P�	Ps�4B�B�BN)rIrJrKrMrmryrNr!rriri�sF�������H�H��[�H�P�P�P�P�Pr!ri�PY_COERCE_C_LOCALEz(C locale coercion disabled at build timec�>�eZdZ		d
d�Zd�Zd�Zd�Zd�Zd�Zd	�Z	dS)�LocaleCoercionTestsNTc
�d�	d|_tst}t}d}|rtg}ddddd�}|�|��|�||d<|�d|���5tr|}|}	nd}d}	tj	r|tgkrd}|�|||||	��ddd��n#1swxYwYtD]i}
dD]d}|�||
|���5|�
��}|
||<|�|||||��ddd��n#1swxYwY�e�jdS)	NFrrorT)�default_localerrp)rq�nominal_localer)rsrPrXrW�LEGACY_LOCALE_WARNING�updatertrYr�
is_androidrSrgrVru)
rar3r4�coerce_c_localerdr2�
extra_varsrv�_expected_warnings�_coercion_expectedrwrqrxs
             r�_check_c_locale_coercionz,LocaleCoercionTests._check_c_locale_coercionsy��
	���� �	<�7�K�?�O� %�� �
<�%:�$;�!����#%�	
�
�
�	���Z�(�(�(��	C�3B�M�/�0��\�\��.=��?�?�	C�	C�0�
+�%6�"�%6�"�"�%)�"�%*�"�
�"�
*�&�+?�*@�@�
*�%)�"��.�.�}�/:�/>�/A�/A�	
C�
C�
C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C�,;�	J�	J�M�/�
J�
J���\�\�'�1>�6E�"�G�G�
J�
J� -�1�1�3�3�H�(5�H�W�%��6�6�x�7B�7F�7H�7H�	J�J�J�
J�
J�
J�
J�
J�
J�
J�
J�
J�
J�
J����
J�
J�
J�
J��
J�	J�	Js%�$AB4�4B8�;B8�$3D#�#D'�*D'c�6�|�ddd���dS)Nr
�r��r��ras r� test_PYTHONCOERCECLOCALE_not_setz4LocaleCoercionTests.test_PYTHONCOERCECLOCALE_not_setis#���%�%�g�w��%�M�M�M�M�Mr!c�@�dD]}|�dd|����dS)N)r�1�true�falser
r�r�)ra�settings  r�!test_PYTHONCOERCECLOCALE_not_zeroz5LocaleCoercionTests.test_PYTHONCOERCECLOCALE_not_zeroms?��2�	U�	U�G��)�)�'�7�G�)�T�T�T�T�	U�	Ur!c�D�|�dddtg���dS)Nr
�warn)r�rd)r�rSr�s r�$test_PYTHONCOERCECLOCALE_set_to_warnz8LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_warnss;���%�%�g�w�6<�9M�8N�	&�	P�	P�	P�	P�	Pr!c��|�ttdd���|�ttddd���dS)N�0F)r�r2r�r�r+r2)r�rXrWr�s r�$test_PYTHONCOERCECLOCALE_set_to_zeroz8LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_zerozsc���%�%�&C�&G�69�8=�	&�	?�	?�	?�
	
�%�%�&C�&G�69�-0�8=�		&�	?�	?�	?�	?�	?r!c��|�ttddd���|�ttddtgd���dS)NrFr�r�)r�r+rdr2)r�rXrWr�r�s r�test_LC_ALL_set_to_Cz(LocaleCoercionTests.test_LC_ALL_set_to_C�sl���%�%�&C�&G�6:�-0�8=�		&�	?�	?�	?�	
�%�%�&C�&G�6<�-0�9N�8O�8=�	&�	?�	?�	?�	?�	?r!c���tjtjd��}|�tjtj|��	tjtjd��}n>#tj$r,}|�t
|����Yd}~nd}~wwxYw|dkr|�d��|tvr|�d|z��d}ttj
d���}tjtjd|gtj|d	�
��}|�|j���|��dS)Nrrz.test requires LC_CTYPE locale different than Czcoerced LC_CTYPE locale: %sz=import locale; print(locale.setlocale(locale.LC_CTYPE, None))r�rrT)�stdout�env�text)�locale�	setlocaler*�
addCleanup�Error�skipTest�str�TARGET_LOCALESr/�os�environ�
subprocess�run�sys�
executable�PIPEr`r�rD)ra�old_loc�loc�e�coder�rs       r�#test_PYTHONCOERCECLOCALE_set_to_onez7LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_one�sM���"�6�?�D�9�9������(�&�/�7�C�C�C�	"��"�6�?�B�7�7�C�C���|�	"�	"�	"��M�M�#�a�&�&�!�!�!�!�!�!�!�!�����	"�����#�:�	L��M�M�J�K�K�K��.� �	?��M�M�7�#�=�>�>�>�O���2�:�3�7�7�7���n�c�n�d�D�9�$.�O�!$�"&�(�(�(��	
�����*�*�,�,�c�2�2�2�2�2s�A,�,B'�;"B"�"B')NT)
rIrJrKr�r�r�r�r�r�r�rNr!rr|r|s�������48�37�	HJ�HJ�HJ�HJ�TN�N�N�U�U�U�P�P�P�?�?�?�
?�
?�
?�3�3�3�3�3r!r|c�,�tj��dSr_)r�
reap_childrenrNr!r�tearDownModuler��s��������r!�__main__)-r�r�r�r��	sysconfigrk�collectionsr�testr�test.support.script_helperrrVrWrXrYr��platform�
startswithr�r,rQ�bool�hasattrrr �_fields�_EncodingDetailsr"r�rRrPr.rSr[�TestCaser]ri�cpython_only�
skipUnless�get_config_varr|r�rI�mainrNr!r�<module>r�sY���
�
�
�	�	�	�	�����
�
�
�
���������"�"�"�"�"�"�������;�;�;�;�;�;�"%�o� 6��%,�!� '��%)�!�/�/�/���<���7�#�#�,���	6�,3�)�(/�%�%�	&�,�,�W�5�5�5�5��\���U�#�#�,�(3�%�$/�!�!��\�X��,�$+�!�!��\�X��,�).�%�%��\�Y��,�(/�%�$+�!�1��"�T��L�+�+���G�F�M�"�"���G�F�I���������O���:�/��9�9��54�54�54�54�54�&�54�54�54�t��J��������N�N�N�<:�:�:�:�:�h�/�:�:�:�<)P�)P�)P�)P�)P�6�)P�)P�)P�Z	�����-�Y�-�.B�C�C�?�A�A�O3�O3�O3�O3�O3�1�O3�O3�A�A���O3�d����z����H�M�O�O�O�O�O��r!