Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_embed.cpython-312.pyc

�

'Μgi���ddlmZddlmZmZmZddlZddlmZddl	Z	ddl
Z
ddlZddlZddl
ZddlZddlZddlZddlZddlZddlZddlZej*sej,d��ej.dk(ZdZdZdZd	ZdZdZd
ZdZ ejBjEejFejHdejJjL�d
ejJjN���Z(ejBjSejBjEe(d��sdZ(d�Z*d�Z+Gd�d�Z,Gd�de,ejZ�Z.Gd�de,ejZ�Z/Gd�dejZ�Z0Gd�de,ejZ�Z1Gd�de,ejZ�Z2Gd�de,ejZ�Z3e4dk(rejj�yy) �)�support)�
import_helper�	os_helper�
MS_WINDOWSN)�
namedtupleztest module requires subprocess�darwin����l���python�.�os.pyc���tjj|�}tjj|�d}|j	�jdj	��S)Nr�_d)�os�path�basename�splitext�casefold�endswith)�program�names  �,/usr/local/lib/python3.12/test/test_embed.py�debug_buildr.sL���g�g���w�'�G�
�7�7���G�$�Q�'�D��=�=�?�#�#�D�M�M�O�4�4�c��ttj�}t|�D]}|j	d�s�||=�|S)N�PYTHON)�dictr�environ�list�
startswith)�env�keys  r�remove_python_envvarsr%4s8��
�r�z�z�
�C��C�y���>�>�(�#��C����Jrc�2�eZdZd�Zd�Zdddddd�d�Zd�Zy)�EmbeddingTestsMixinc��d}tjjtj�}t
r(t
tj�rdnddz}||z
}|}n tjj|d�}tjj||�x|_}tjj|�s|jd|z�tj�|_tj|�y)N�
_testembedr��.exe�Programsz%r doesn't exist)rr�dirname�sys�
executablerr�join�test_exe�exists�skipTest�getcwd�oldcwd�chdir)�self�exename�builddir�ext�exepath�exes      r�setUpzEmbeddingTestsMixin.setUp>s������7�7�?�?�3�>�>�2���&�s�~�~�6�4�B�&�H�C��s�N�G��G��g�g�l�l�8�Z�8�G� �g�g�l�l�7�G�<�<��
���w�w�~�~�c�"��M�M�,�s�2�3��i�i�k���
����rc�B�tj|j�y�N)rr6r5�r7s r�tearDownzEmbeddingTestsMixin.tearDownPs��
������rNr)r#�timeout�
returncode�input�cwdc��|jg}|j|�|�,tr&|j�}tj
d|d<t
j|tjtjd||��}	|j||��\}	}
|j|k7rFtjr6td|�d��td|	���td|
���td	�|j!|j|d
|j|
fz�|	|
fS#|j�|j��xYw)z'Runs a test in the embedded interpreter�
SYSTEMROOTT)�stdout�stderr�universal_newlinesr#rE)rDrBz--- z failed ---zstdout:
zstderr:
z------zbad returncode %d, stderr is %r)r1�extendr�copyrr �
subprocess�Popen�PIPE�communicate�	terminate�waitrCr�verbose�print�assertEqual)r7r#rBrCrDrE�args�cmd�p�out�errs           r�run_embedded_interpreterz,EmbeddingTestsMixin.run_embedded_interpreterSs!���}�}�o���
�
�4���?�z��(�(�*�C� "�
�
�<� 8�C������S�$.�O�O�$.�O�O�04�!$�!$�
&��	����U�G��D�J�S�#�

�<�<�:�%�'�/�/��D���[�)�*��I�c�U�#�$��I�c�U�#�$��(�O�������z�:��,�,��,�-�	.��C�x���	�
�K�K�M�
�F�F�H��s�D � #Ec#�ZK�|jd�\}}|j|d�d}tdd�}d}g}|j�D�][}|dj	|�k(r?|jt|�d�tjdkDrt|�|dz
}�W|jt|�d	�tj||�}|�|j||�||j��}	tjdkDrt|	�|j|	j�|j|	j �|j|	j"�|j%|	�t|�d	k(s��?|d}
|j|	|
�|��g}��^y�w)
N�&test_repeated_init_and_subinterpretersr*zS^interp (\d+) <(0x[\dA-F]+)>, thread state <(0x[\dA-F]+)>: id\(modules\) = ([\d]+)$�Interpzid interp tstate modulesrz--- Pass {} ---r�)r[rUr�
splitlines�format�lenrrSrT�
assertLess�re�match�assertRegex�groups�
assertTrue�interp�tstate�modules�append)r7rYrZ�
interp_patr^�numloops�current_run�linereri�mains           r�%run_repeated_init_and_subinterpretersz9EmbeddingTestsMixin.run_repeated_init_and_subinterpretersvsr�����0�0�1Y�Z���S�����b�!�2�
��H�&@�A�������N�N�$�D��(�/�/��9�9�� � ��[�!1�1�5��?�?�Q�&��$�K��A�
����O�O�C��,�a�0��H�H�Z��.�E��}�� � ��z�2��U�\�\�^�,�F�����"��f�
��O�O�F�M�M�*��O�O�F�M�M�*��O�O�F�N�N�+����v�&��;��1�$�"�1�~��� � ���.�!�!� ��9%�s�FF+�
!F+)�__name__�
__module__�__qualname__r=rAr[rr�rrr'r'=s&���$�37�)-�!�4�%)�!�F1!rr'c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zej&d��Zd�Zd�Zd�Zy)�EmbeddingTestsi�c�p�|j�D]#}|d}|j|jd��%y)Nr�0)rrrU�id)r7�runrqs   r�test_subinterps_mainz#EmbeddingTests.test_subinterps_main�s3���=�=�?�C��q�6�D����T�W�W�c�*�@rc	���|j�D][}|�^}}}t|j�}t|�D]0\}}|j	|jt||zdz���2�]y)Nr)rr�intr{�	enumeraterU�str)r7r|rq�subs�_�mainid�i�subs        r�test_subinterps_different_idsz,EmbeddingTests.test_subinterps_different_ids�sa���=�=�?�C� �N�D�4������\�F�#�D�/���3�� � �����V�a�Z�!�^�)<�=�*�	@rc�^�|j�D]�}|�^}}}d|vrtjd��|D]t}|j|j|j�|j|j
|j
�|j|j|j��v��y)N�0x0zplatform prints pointers as 0x0)rr�unittest�SkipTest�assertNotEqualrirjrk)r7r|rqr�r�r�s      r�test_subinterps_distinct_statez-EmbeddingTests.test_subinterps_distinct_state�s����=�=�?�C� �N�D�4����}�
�'�'�(I�J�J����#�#�C�J�J����<��#�#�C�J�J����<��#�#�C�K�K����>��@rc���|jd�\}}|j|d�tdtdz�D�cgc]}d|�d���
}}dj	|�dz}|j||�ycc}w)N�test_repeated_init_and_inittabr*rz	--- Pass z ---�
)r[rU�range�
INIT_LOOPSr0)r7rYrZr��liness     rr�z-EmbeddingTests.test_repeated_init_and_inittab�sz���0�0�1Q�R���S�����b�!�.3�A�z�!�|�.D�E�.D��9�Q�C�t�$�.D��E��	�	�%� �4�'������e�$��Fs�
A2c�p�ttjd��}|jd|��\}}tj
dkDr t
�t
|�t
|�d}d}djgd	��}|j|||�
�}d|_	|j|j�|�y)Nzutf-8:surrogateescape)�PYTHONIOENCODING�test_forced_io_encoding�r#r�utf-8�surrogateescaper�)z--- Use defaults ---�Expected encoding: default�Expected errors: defaultzstdin: {in_encoding}:{errors}zstdout: {out_encoding}:{errors}�'stderr: {out_encoding}:backslashreplacez--- Set errors only ---r�zExpected errors: ignorezstdin: {in_encoding}:ignorezstdout: {out_encoding}:ignorer�z--- Set encoding only ---�Expected encoding: iso8859-1r�zstdin: iso8859-1:{errors}zstdout: iso8859-1:{errors}�"stderr: iso8859-1:backslashreplacez--- Set encoding and errors ---r�zExpected errors: replacezstdin: iso8859-1:replacezstdout: iso8859-1:replacer�)�in_encoding�out_encoding�errors)rrr r[rrSrTr0ra�maxDiffrU�strip)r7r#rYrZ�expected_stream_encoding�expected_errors�expected_outputs       rr�z&EmbeddingTests.test_forced_io_encoding�s����2�:�:�0G�H���0�0�1J�PS�0�T���S��?�?�Q���G��#�J��#�J�#*� �+���)�)�%.�/��2*�0�0�,D�-E�'6�1�8��
����������o�6rc��ttjtjj	t
j���}|jd|��\}}tr
|j}n2tjj	tj�d�}d|�d�}|j||�|j|d�y)	z�
        Checks some key parts of the C-API that need to work before the runtime
        is initialized (via Py_Initialize()).
        )�
PYTHONPATH�test_pre_initialization_apir��spamzsys.executable: r�r*N)
rrr �pathsepr0r.rr[rr1r4�assertInrU)r7r#rYrZ�
expected_pathr�s      rr�z*EmbeddingTests.test_pre_initialization_apis���
�2�:�:�"�*�*�/�/�#�(�(�*C�D���0�0�1N�TW�0�X���S�� �M�M�M��G�G�L�L�����f�=�M�,�]�O�2�>���
�
�o�s�+�����b�!rc���t�}tjjtj
�|d<|j
d|��\}}d}|j||�|j|d�y)z�
        Checks that sys.warnoptions and sys._xoptions can be set before the
        runtime is initialized (otherwise they won't be effective).
        r��#test_pre_initialization_sys_optionsr�z�sys.warnoptions: ['once', 'module', 'default']
sys._xoptions: {'not_an_option': '1', 'also_not_an_option': '2'}
warnings.filters[:3]: ['default', 'module', 'once']
r*N)	r%rr�r0r.rr[r�rU)r7r#rYrZr�s     rr�z2EmbeddingTests.test_pre_initialization_sys_optionssq��
$�%���J�J�O�O�C�H�H�5��L���0�0�=�3�1�H���S�
D�	�
	
�
�
�o�s�+�����b�!rc�t�|jd�\}}|j|d�|j|d�y)ze
        bpo-20891: Calling PyGILState_Ensure in a non-Python thread must not
        crash.
        �
test_bpo20891r*N�r[rU�r7rYrZs   rr�zEmbeddingTests.test_bpo20891#s8��
�0�0��A���S�����b�!�����b�!rc�t�|jd�\}}|j|d�|j|d�y)zf
        bpo-33932: Calling Py_Initialize() twice should do nothing (and not
        crash!).
        �test_initialize_twicer*Nr�r�s   rr�z$EmbeddingTests.test_initialize_twice,s9��
�0�0�1H�I���S�����b�!�����b�!rc��|jd�\}}|j|j�d�|j|d�y)zS
        bpo-34008: Calling Py_Main() after Py_Initialize() must not fail.
        �test_initialize_pymainz6Py_Main() after Py_Initialize: sys.argv=['-c', 'arg2']r*N�r[rU�rstripr�s   rr�z%EmbeddingTests.test_initialize_pymain5s@���0�0�1I�J���S��������'_�`�����b�!rc��|jd�\}}|j|j�d�|j|d�y)N�
test_run_mainz%Py_RunMain(): sys.argv=['-c', 'arg2']r*r�r�s   rr�zEmbeddingTests.test_run_main=s=���0�0��A���S��������'N�O�����b�!rc�~�d}|jd�\}}|j|d|z�|j|d�y)Nr_�test_run_main_loopz&Py_RunMain(): sys.argv=['-c', 'arg2']
r*r�)r7�nlooprYrZs    rr�z!EmbeddingTests.test_run_main_loopBsD�����0�0�1E�F���S�����G�%�O�P�����b�!rc���tjd�}t|d��5}|j�}ddd�|j	d�\}}|j|dtz�y#1swY�8xYw)Nz_test_embed_structseq.pyr���encoding�test_repeated_init_exec�
Tests passed
)r�findfile�open�readr[rUr�)r7�script�fp�coderYrZs      r�test_finalize_structseqz&EmbeddingTests.test_finalize_structseqJsg���!�!�"<�=��
�&�7�
+�r��7�7�9�D�,��0�0�1J�D�Q���S�����.��;�<�,�
+�s�A+�+A4c�^�|jd�\}}|j|dtz�y)N�test_repeated_simple_initz
Finalized
�r[rUr�r�s   r�test_simple_initialization_apiz-EmbeddingTests.test_simple_initialization_apiVs.���0�0�1L�M���S�����m�j�8�9rc��tjd�}|j}|d|�\}}|j|dtz�y)Na#            import dis
            import importlib._bootstrap
            import opcode
            import test.test_dis

            def is_specialized(f):
                for instruction in dis.get_instructions(f, adaptive=True):
                    opname = instruction.opname
                    if (
                        opname in opcode._specialized_instructions
                        # Exclude superinstructions:
                        and "__" not in opname
                    ):
                        return True
                return False

            func = importlib._bootstrap._handle_fromlist

            # "copy" the code to un-specialize it:
            func.__code__ = func.__code__.replace()

            assert not is_specialized(func), "specialized instructions found"

            for i in range(test.test_dis.ADAPTIVE_WARMUP_DELAY):
                func(importlib._bootstrap, ["x"], lambda *args: None)

            assert is_specialized(func), "no specialized instructions found"

            print("Tests passed")
        r�r���textwrap�dedentr[rUr�)r7r�r|rYrZs     r�>test_specialized_static_code_gets_unspecialized_at_Py_FINALIZEzMEmbeddingTests.test_specialized_static_code_gets_unspecialized_at_Py_FINALIZE\sK����� �
��>�+�+���0�$�7���S�����.��;�<rc�d�d}|jd|�\}}|j|dtz�y)Nzprint('\N{digit nine}')r�z9
r��r7r�rYrZs    r�test_ucnhash_capi_resetz&EmbeddingTests.test_ucnhash_capi_reset�s3��)���0�0�1J�D�Q���S�����e�j�0�1rc��tjd�}i}t|||�|d}~|tjd�z
}|jd||�\}}|j	d�dd}|D�cgc]}|jd�d��}}d|_t|d�	�D]�\}}	tj|	�}
|j�D]D\}}|j||�
�5|
j|�}
|j|
|�ddd��F|j|
i���|j|d�ycc}w#1swY�|xYw)Na 
            import test.support

            results = {}
            def add(cls, slot, own):
                value = getattr(cls, slot)
                try:
                    subresults = results[cls.__name__]
                except KeyError:
                    subresults = results[cls.__name__] = {}
                subresults[slot] = [repr(value), own]

            for cls in test.support.iter_builtin_types():
                for slot, own in test.support.iter_slot_wrappers(cls):
                    add(cls, slot, own)
            �resultsz�
            import json
            import sys
            text = json.dumps(results)
            print(text, file=sys.stderr)
            r�z
--- Loop #rz ---
���)�start)�loop�clsr*)r�r��execr[�split�
rpartitionr�r��json�loads�items�subTest�poprU)r7r��ns�all_expectedrYrZr��resr��text�result�	classname�expected�slotss              r�!test_static_types_inherited_slotsz0EmbeddingTests.test_static_types_inherited_slots�sM�����"���"���V�R����)�}����(�/�/�#��	���0�0�)�6�6�;���S��)�)�L�)�!�"�-��;B�C�7�C�3�>�>�(�+�B�/�7��C���� ���2�G�A�t��Z�Z��%�F�'3�'9�'9�';�#�	�8��\�\�q�i�\�8�"�J�J�y�1�E��$�$�U�H�5�9�8�(<�
���V�R�(�
3�	
����b�!��D�9�8�s�1D;�&$E�E	c��tjd�}|jd|�\}}|j|dtz�y)NaC
            try:
                import _ssl
            except ModuleNotFoundError:
                _ssl = None
            if _ssl is not None:
                _ssl.txt2obj(txt='1.3')
            print('1')

            import _queue
            _queue.SimpleQueue().put_nowait(item=None)
            print('2')
        r�z1
2
r�r�s    r� test_getargs_reset_static_parserz/EmbeddingTests.test_getargs_reset_static_parser�sE����� �
���0�0�1J�D�Q���S�����h��3�4rN)rsrtrur�r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�requires_specializationr�r�r�r�rvrrrxrx�sy���G�+�>�?�*%�)7�V
"�"�""�"�"�"�
"�
=�:�
�$�$�$=�%�$=�L2�*"�X5rrxc�z�eZdZdZerdndZe�Ze�Ze	e
dddddd�Zerejddi�e
eedee��Ze
eedddddd�	�Zgd
�Zide	�dd�d
d�dd�dd�dd�dd�dej(j*�dd�dd�dd�dd�dd�dd�dd�dd�de�ide�dd�de�d d�d!d"g�d#g�d$g�d%g�d&d�d'd�d(e�d)e�d*e�d+e�d,e�d-e�d.e��id/d�d0ej,�d1e�d2d�d3d�d4d�d5d�d6d�d7d�d8d�d9d�d:d�d;d�d<d�d=d�d>d�d?e��edddddd@ddej0dedA��ZerejdBdi�e
eeddC�D�Ze
eeddddddddddd�E�
ZerdedB<ddddF�ZdGgZgdH�Zer"ej?dI�ej?dJ�dZ e!dK��Z"dL�Z#dM�Z$dN�Z%	d�dO�Z&dP�Z'dQ�Z(dR�Z)				d�dddSddT�dU�Z*dV�Z+dW�Z,dX�Z-dY�Z.dZ�Z/d[�Z0d\�Z1d]�Z2d^�Z3d_�Z4d`�Z5da�Z6db�Z7dc�Z8dd�Z9de�Z:df�Z;dg�Z<dh�Z=di�Z>e?j�dj�dk��ZAdl�ZBdm�ZCdn�ZDdo�ZEdp�ZFdq�ZGdr�ZHds�ZId�dt�ZJeKj�d�du��ZMdv�ZNdw�ZOdx�ZPe?j�edy�dz��ZRe?j�ed{�d|��ZTd}�ZUe?j�ed~�d��ZVd��ZWd��ZXd��ZYd��ZZd��Z[d��Z\y)��InitConfigTestsi�
surrogatepassr�rr)�_config_init�	allocator�
parse_argv�configure_locale�coerce_c_locale�coerce_c_locale_warn�	utf8_mode�legacy_windows_fs_encoding)r�r�r�r�)r�r��isolated�use_environmentr��dev_moder�)r�r�r�r�r�r�r��install_signal_handlers�
use_hash_seed�	hash_seed�int_max_str_digits�faulthandler�tracemalloc�perf_profiling�import_time�code_debug_ranges�show_ref_count�	dump_refs�malloc_stats�filesystem_encoding�filesystem_errors�pycache_prefixN�program_namer��argvr*�	orig_argv�xoptions�warnoptions�pythonpath_env�homer/�base_executable�prefix�base_prefix�exec_prefix�base_exec_prefix�module_search_paths�module_search_paths_set�
platlibdir�
stdlib_dir�site_import�
bytes_warning�warn_default_encoding�inspect�interactive�optimization_level�parser_debug�write_bytecoderS�quiet�user_site_directory�configure_c_stdio�buffered_stdio�stdio_encoding�default)�stdio_errors�skip_source_first_line�run_command�
run_module�run_filename�_install_importlib�check_hash_pycs_mode�pathconfig_warnings�
_init_main�use_frozen_modules�	safe_path�_is_python_build�legacy_windows_stdior	)r�r(r�)r�r�r�r'r6r�r�rrrrr3)�Py_HasFileSystemDefaultEncoding�Py_HashRandomizationFlag�$_Py_HasFileSystemDefaultEncodeErrors)�Py_UTF8Moder�))�Py_BytesWarningFlagr)�Py_DebugFlagr$)�Py_DontWriteBytecodeFlagr%T)� Py_FileSystemDefaultEncodeErrorsr)�Py_FileSystemDefaultEncodingr)�
Py_FrozenFlagr3T)�Py_IgnoreEnvironmentFlagr�T)�Py_InspectFlagr!)�Py_InteractiveFlagr")�Py_IsolatedFlagr�)�
Py_NoSiteFlagrT)�Py_NoUserSiteDirectoryr'T)�Py_OptimizeFlagr#)�Py_QuietFlagr&)�Py_UnbufferedStdioFlagr)T)�Py_VerboseFlagrS))�Py_LegacyWindowsFSEncodingFlagr�))�Py_LegacyWindowsStdioFlagr8c��d|_yr?)�EXPECTED_CONFIG)r�s r�
tearDownClasszInitConfigTests.tearDownClass�s��#��rc�`�i}|D]&}d|vr|jdd�\}}|||<�"d||<�(|S)N�=rT)r�)r7�
xoptions_listr�optr$�values      r�
main_xoptionszInitConfigTests.main_xoptions�sE���� �C��c�z� �Y�Y�s�A�.�
��U� %���
� $���
�!��rc���t�}tjd�}tjdd|g}tj||t
jt
j��}|jr%td|j�d|j����|jjd�}	tj|�S#tj$r|j!d|���YywxYw)	Na4
            import json
            import sys
            import _testinternalcapi

            configs = _testinternalcapi.get_configs()

            data = json.dumps(configs)
            data = data.encode('utf-8')
            sys.stdout.buffer.write(data)
            sys.stdout.buffer.flush()
        z-S�-c)r#rHrIz)failed to get the default config: stdout=z stderr=r��fail to decode stdout: )r%r�r�r.r/rMr|rOrC�	ExceptionrHrI�decoder�r��JSONDecodeError�fail)r7r#r�rV�procrHs      r�_get_expected_config_implz)InitConfigTests._get_expected_config_impl�s���#�%����� �
������d�D�1���~�~�d��%/�_�_�%/�_�_�6���?�?��&�&*�k�k�_�H�T�[�[�O�M�N�
N����#�#�G�,��	<��:�:�f�%�%���#�#�	<��I�I�/��z�:�;�	<�s�6C�'C5�4C5c�$�t}|j�|j�|_i}|jj�D]I\}}i}|j�D]*\}}t	|t
�r|j
�}|||<�,|||<�K|Sr?)r�rPr`r��
isinstancer!rL)r7r��configs�
config_key�config_value�configr$rVs        r�_get_expected_configz$InitConfigTests._get_expected_config�s��������&�"&�"@�"@�"B�C����(+�(;�(;�(A�(A�(C�$�J���F�*�0�0�2�
��U��e�T�*�!�J�J�L�E�#��s��3�#)�G�J��
)D��rc���|j�}|d}|j�D]\}}	|	|jus�||||<�|dr	|tk(rdD]}|j||<�|ds|j|d<|ddk(rb|d|jurd|d<|d|jur|j
|d<|d	|jurd|d	<|d
|jurd|d
<tr
|j}
nf|d|jur#tjj|d�}
n2tjjtj�d
�}
|d|jur|
|d<|d|jur|
|d<|d|jurd|d<|d}|j�D]\}}	|	|jus�||||<�|d|jur_|d}|�5|jtjj�}
g|
�|d�|d<|�!|dj�|d<||d�|j D]}||vs�||||<�y)N�
pre_configr�)rrr*r,r�rrr�rr*r,r�rr)r/rz./_testembedrfrr)rgr��GET_DEFAULT_CONFIG�
API_COMPAT�
IGNORE_CONFIG�UTF8_MODE_ERRORSrr1rr�abspathr0r4r�r�rL�COPY_PRE_CONFIG)r7�expected_preconfigr�r#�api�modify_path_cbrcrir$rV�default_executablerfr�pathss              r�get_expected_configz#InitConfigTests.get_expected_config�s����+�+�-���\�*�
�,�2�2�4�J�C����/�/�/�*4�S�/�"�3�'�5�"�"4�5��
�9J�:�� $� 2� 2���
�:�"�"4�5�/3�.@�.@��{�+��k�*�a�/��-�.�$�2I�2I�I�29��.�/��+�,��0G�0G�G�04�0E�0E��,�-��(�)�T�-D�-D�D�-4��)�*���'�4�+B�+B�B�+<���(��!%����
�n�
%�T�-D�-D�
D�!#������.�1I�!J��!#�����b�i�i�k�<�!H���L�!�T�%<�%<�<�%7�H�\�"��%�&�$�*A�*A�A�*<�H�&�'��N�#�t�'>�'>�>�'5�H�^�$���"��"�.�.�*�J�C����/�/�/� &�s����
�+��)�*�$�2D�2D�D�%�&6�7�N��)�&�,�,�R�W�W�_�_�=��2\�E�2\�H�EZ�<[�2\��.�/��)�2:�;P�2Q�2V�2V�2X��.�/��x�(=�>�?��'�'�C��,�,�*2�3�-�"�3�'�(rc���t|d�}t|j��D])\}}||jus�|j	|d�||=�+|j||�y)Nri)rr!r�rlr�rU)r7rcr�rir$rVs      r�check_pre_configz InitConfigTests.check_pre_configs`���'�,�/�0�
��x�~�~�/�0�J�C����*�*�*����s�D�)��S�M�1�	
����X�.rc��t|d�}tr�|jdx}�}|r�t|t�rt|dt|j
�jd��}ttj�r+|dt|j
�jd��}|||<t|j��D])\}}||jus�|j|d�||=�+|j||�y)Nrfrr+r)rr�getrbr�rb�lower�removesuffixrr.r/r!r�rlr�rU)r7rcr�rfr$rVs      r�check_configzInitConfigTests.check_configs����g�h�'�(����J�J�n�4�s�5�E���E�3�/��F�s�5�;�;�=�#=�#=�f�#E�F�G���s�~�~�.�!�"H�3�u�{�{�}�'A�'A�$�'G�#H�I�E�#��s���x�~�~�/�0�J�C����*�*�*��
�
�3��%��S�M�1�	
�����*rc�h�|d}|d}t|j�}|jD]0}t|�dk(r|\}}}||rdnd||<�$|\}}||||<�2|jD]0}t|�dk(r|\}}}||rdnd||<�$|\}}||||<�2|j|d|�y)Nrirfr
rr�
global_config)r�DEFAULT_GLOBAL_CONFIG�COPY_GLOBAL_CONFIGrb�COPY_GLOBAL_PRE_CONFIGrU)	r7rcrirfr��item�
global_key�core_key�opposites	         r�check_global_configz#InitConfigTests.check_global_configs����\�*�
���"����2�2�3���+�+�D��4�y�A�~�15�.�
�H�h�,2�8�,<�q�!���$�'+�$�
�H�'-�h�'7���$�
,��/�/�D��4�y�A�~�15�.�
�H�h�,6�x�,@�q�a���$�'+�$�
�H�'1�(�';���$�
0�	
�����1�8�<rF)�
preconfig_apir#�
ignore_stderrrEc��t�}|�|j|�|}|�|}|tk(r
|j}n"|tk(r
|j
}n|j}|�i}t|fi|��}|�i}|tk(r
|j}
n"|tk(r
|j}
n|j}
t|
fi|��}|j|||||�|j|||
��\}}|�|dsd}|�"|	s |j|j�|�	tj |�}|j'|�|j)||�|j+|�|S#tj"$r|j%d|���Y�`wxYw)N)r#rErSr*rZ)r%�update�API_ISOLATED�PRE_CONFIG_ISOLATED�
API_PYTHON�PRE_CONFIG_PYTHON�PRE_CONFIG_COMPATr�
CONFIG_PYTHON�CONFIG_ISOLATED�
CONFIG_COMPATrur[rUr�r�r�r]r^rwr|r�)r7�testname�expected_configrprrrIrqr�r#r�rE�new_env�default_preconfig�default_configrYrZrcs                 r�check_all_configsz!InitConfigTests.check_all_configs-s���
(�)���?��N�N�3����� ��M��L�(� $� 8� 8��
�j�
(� $� 6� 6�� $� 6� 6���%�!#��!�"3�J�7I�J���"� �O��*��!�/�/�N�
�L�
 �!�1�1�N�!�/�/�N��~�A��A��� � �!3�!0�!$�!$�n�	6�
�0�0��58�c�1�C���S��>�/�)�"<��F���m����S�Z�Z�\�6�2�	9��j�j��o�G�	
���g�'9�:����'�?�3�� � ��)����
�#�#�	9��I�I�/��w�7�8�	9�s�E�'F�Fc�2�|jdt��y)N�test_init_initialize_config�rq�r�rkr@s r�test_init_default_configz(InitConfigTests.test_init_default_configcs�����<�*��Mrc�2�|jdt��y)N�test_preinit_compat_configr�r�r@s rr�z*InitConfigTests.test_preinit_compat_configf������;���Lrc�2�|jdt��y)N�test_init_compat_configr�r�r@s rr�z'InitConfigTests.test_init_compat_configi������8�j��Irc�`�ddi}ddddgdddddddddd�
}|jd||t�	�y)
Nr�rz./globalvarr�default::BytesWarningr	)
rrrrr!r"r#r%rSr&r)r'r3�test_init_global_configr�r��r7�	preconfigrfs   rr�z'InitConfigTests.test_init_global_configls`����
�	�*���3�4���"#�����#$�#$�
�� 	
���8�&�)�#-�	�	/rc�L�tdd�}idd�dd�dd�dd	�d
d�dd�dd�d
d�dd�dd�dd�dd�dd�dddg�dgd��dd	�dgd��idgd ��d!d"�d#d�d$d�d%d�d&d�d'd	�d(d�d)d�d*d�d+d�d,d�d-d�d.d�d/d0�d1|j�d2d��d3d4dd5��}|jd6||t�7�y)8Nr�r�r�r�rrr�{rr	rrrrr
r*�	iso8859-1r,�replacer
�conf_pycache_prefixrz./conf_program_namerrY�arg2r)�python3�-W�cmdline_warnoption�-X�cmdline_xoptionrY�passr�r�r)zconfig_xoption1=3zconfig_xoption2=�config_xoption3r�r)r�r��config_warnoptionr.�pass
rrr!r"r#r%rSr&r(r)r'rr�
my_platlibdirrr6iiz�always)rr2r3�test_init_from_configr���PYMEM_ALLOCATOR_MALLOCrlr�rkr�s   rr�z%InitConfigTests.test_init_from_config�s��/��
�	�7
�%�q�7
��Q�7
�
��7
�
�1�	7
�

�a�7
�
�1�
7
�
 ��7
�
�a�7
�
�A�7
�
�k�7
�
�I�7
�
�3�7
�
�1�7
� 
�T�6�N�!7
�"
�"�#7
�,
�!�-7
�.
��/7
�:
��;7
�D
�8�E7
�H
�1�I7
�J
�Q�K7
�L
�q�M7
�N
�1�O7
�P
!�!�Q7
�R
�a�S7
�T
�q�U7
�V
�Q�W7
�X
 ��Y7
�Z
�a�[7
�\
"�1�]7
�^
�A�_7
�`
�/�a7
�b
"�4�#5�#5�c7
�d
��e7
�f#(�$,�#$�m7
��p	
���6��	�#-�	�	/rc���dti}idd�dd�dd�dd	�d
d�dd	�dd�d
d�dd�dd�dd�dd	�dd�dd	�dd�dd�dd	�ddgd|jddd��}|jd||t� �y)!Nr�rrr�*rr	rrrrr
r!r#r�/my/pathr
�env_pycache_prefixr%rSr)r*r�r,r�r'�EnvVar�env_platlibdir���rrrrr6r�test_init_compat_envr�r�r�s   rr�z$InitConfigTests.test_init_compat_env�s���/�
�	�
��Q�
���
�
�1�
�
�a�	
�

�1�
�
 ��

�
�A�
�
�q�
�
!�!�
�
�j�
�
�2�
�
�a�
�
�q�
�
�a�
�
�k�
� 
�I�!
�"
"�1�#
�$�$�:�*�#'�#5�#5��"&�/
��2	
���5�v�y�#-�	�	/rc���tdd�}idd�dd�dd�dd	�d
d�dd	�dd�d
d�dd�dd�dd�dd	�dd�dd	�dd�dd�dd	�ddgd|jddd��}|jd||t� �y)!Nrr�rrr�rr	rrrrr
r!r#rr�r
r�r%rSr)r*r�r,r�r'r�r�r�r��test_init_python_envr�)r�rlr�r�r�s   rr�z$InitConfigTests.test_init_python_env�s��/��
�	�
��Q�
���
�
�1�
�
�a�	
�

�1�
�
 ��

�
�A�
�
�q�
�
!�!�
�
�j�
�
�2�
�
�a�
�
�q�
�
�a�
�
�k�
� 
�I�!
�"
"�1�#
�$�$�:�*�#'�#5�#5��"&�/
��2	
���5�v�y�#-�	�	/rc�t�tt��}tdddg��}|jd||t��y)N�r�rr+�r�rr�test_init_env_dev_moder�)r�PYMEM_ALLOCATOR_DEBUGr�rkr�s   rr�z&InitConfigTests.test_init_env_dev_modes@���#8�9�	��q�#$�#,�+�/��	
���7���#-�	�	/rc�t�tt��}tdddg��}|jd||t��y)Nr�rr+r��test_init_env_dev_mode_allocr�)rr�r�rkr�s   rr�z,InitConfigTests.test_init_env_dev_mode_allocs@���#9�:�	��q�#$�#,�+�/��	
���=�v�y�#-�	�	/rc�T�dti}dddgd�}|jd||t��y)Nr�rr+)rr�r�test_init_dev_moder�)r�r�r�r�s   rr�z"InitConfigTests.test_init_dev_modesB���.�
�	���%�;�
��
	
���3�V�Y�#-�	�	/rc	��dti}dggd�tjjd�dddgdgdd�}|j	d||t
�	�y)
Nr��	script.py)r�r��dev�-Pr�rr+r�)rrr0r�rrrr6�test_preinit_parse_argvr�)r�rrrnr�r�r�s   rr�z'InitConfigTests.test_preinit_parse_argv sd��
�.�
�	�!�M�D��G�G�O�O�K�8���%�;����	
��	
���8�&�)�#-�	�	/rc�R�ddi}gd�}||dd�}|jd||t��y)Nr�r)	r��-E�-Ir�r�r�r��utf8r�)rrr��test_preinit_dont_parse_argvr��r�r�)r7r�rrfs    rr�z,InitConfigTests.test_preinit_dont_parse_argv3sH��
��
�	������
��
	
���=�v�y�#/�	�	1rc�B�ddddd�}|jd|t��y)Nrr�r�r6r�r'�test_init_isolated_flagr��r�r��r7rfs  rr�z'InitConfigTests.test_init_isolated_flagEs-���� �#$�	
��	
���8�&�j��Qrc�B�ddddd�}|jd|t��y)Nrrr��test_preinit_isolated1r�r�r�s  rr�z&InitConfigTests.test_preinit_isolated1N�/���� �#$�	
��	
���7��Z��Prc�B�ddddd�}|jd|t��y)Nrrr��test_preinit_isolated2r�r�r�s  rr�z&InitConfigTests.test_preinit_isolated2Xr�rc�2�|jdt��y)N�test_preinit_isolated_configr�r�r@s rr�z,InitConfigTests.test_preinit_isolated_configbs�����=�<��Prc�2�|jdt��y)N�test_init_isolated_configr�r�r@s rr�z)InitConfigTests.test_init_isolated_configes�����:���Mrc�2�|jdt��y)N�test_preinit_python_configr�r�r@s rr�z*InitConfigTests.test_preinit_python_confighr�rc�2�|jdt��y)N�test_init_python_configr�r�r@s rr�z'InitConfigTests.test_init_python_configkr�rc�@�ddd�}|jdi|t��y)Nr)r�r��test_init_dont_configure_localer�r�)r7r�s  rr�z/InitConfigTests.test_init_dont_configure_localens0��!"� �
�	�	
���@�"�i�#-�	�	/rzSas of 3.11 this test no longer works because path calculations do not occur on readc�H�dddd�}d�}|jd|t|��y)Nz./init_read_set�
my_executable)rr/rc�J�|jdd�|jd�y)Nr�test_path_insert1�test_path_append)�insertrl)rs r�modify_pathz7InitConfigTests.test_init_read_set.<locals>.modify_paths���K�K��.�/��K�K�*�+r�test_init_read_set)rqrrr�)r7rfr�s   rr�z"InitConfigTests.test_init_read_setws9��.�)�.�
��
	,�	
���3�V�#-�.9�	�	;rc�N�dgd�gd�gd�d�}|jd|t��y)Nr)�config_xoptionr��sysadd_xoptionr)�ignore:::cmdline_warnoptionzignore:::sysadd_warnoptionzignore:::config_warnoption)r�r�r�r�r�)rrrr�test_init_sys_addr�r�r�s  rr�z!InitConfigTests.test_init_sys_add�s3�����
3�
��"	
���2�F�
��Krc�Z�d}ddgdd|dgd|dzdd�}|jd	|t�
�y)N�Rimport _testinternalcapi, json; print(json.dumps(_testinternalcapi.get_configs()))rYr�r��	./python3r�r	)rrrr.r��test_init_run_mainr�r��r7r�rfs   rrz"InitConfigTests.test_init_run_main�sK��E���6�N�#�T�4��8�'��$�;��
��	
���3�V���Lrc�^�d}ddgdd|dgd|dzddd	�}|jd
|td��y)
Nr�rYr�r�rr�r	r)rrrr.r�r4�test_init_mainz)Run Python code before _Py_InitializeMain)rqrIr�rs   rrzInitConfigTests.test_init_main�s]��E���6�N�#��� �"�(��$�;���	
��	
���/��#-�&Q�	�	Src�N�dgd�gd�dddd�}|jd|t�	�y)
Nr	)rY�arg1�-v�arg3��./argv0r�rYr�rrrr
r�r)r�rrrr.r��test_init_parse_argvr�r�r�s  rrz$InitConfigTests.test_init_parse_argv�s3���0�N�%�#� �

��	
���5�v�:��Nrc�T�ddi}dgd�gd�dd�}|jd||t��y)Nr�rr	r
)r�rrr�test_init_dont_parse_argvr�r�)r7rirfs   rr
z)InitConfigTests.test_init_dont_parse_argv�sB���!�
�
��I�N�%�	
��	
���:�F�J�#-�	�	/rc��trd}|j}n.d}tr
|j}ntj|�xsd}|j|||d��y)Nr
r�r*)rrr/)rr1�MACOS�shutil�whichr�)r7rfrr/s    r�default_program_namez$InitConfigTests.default_program_name�sQ���#�L����J�$�L��!�]�]�
�#�\�\�,�7�=�2�
��
�
�(�)�$�
�	rc���|j�}|dd}|dddddd�}|j|�dtjjj|�i}|j
d|t|d��y)	Nrfrr*)rrrrrr�TESTPATH�test_init_setpathT�rqr#r�)rgrrrr�r0r�rk�r7rfrtr#s    rrz!InitConfigTests.test_init_setpath�s����*�*�,���x� �!6�7��$)���� "��	
��	
�!�!�&�)��2�7�7�?�?�/�/��6�7�����2�F�#-�3�-1�	�	3rc��|j�}|dd}|dddddtjdddd�
}dtjj
j
|�i}|jd|t|d	�
�y)Nrfrr*�conf_program_name�conf_executable)
rrrrrrr5rrr/r�test_init_setpath_configTr)	rgr�Py_DEBUGrrr�r0r�r�rs    rrz(InitConfigTests.test_init_setpath_config�s����*�*�,���x� �!6�7��$)���� "��&-�&6�&6�"6�/�0�+�
�� �2�7�7�?�?�/�/��6�7�����9�6�#-�3�d�	�	Lrc
�<�|j�}|�|dd}|�|dd}tr|ddStj}tj
j
|tjd|j�|j�d��tj
j
|tjd|j�d|j���tj
j
|tjd|j�d|j��d�gS)Nrfrrr
z.zipr�lib-dynload)
rgrr.�version_inforrr0r�major�minor)r7rrrf�vers     rrz#InitConfigTests.module_search_pathss����*�*�,���>��H�%�h�/�F��� ��*�8�4�K���(�#�$9�:�:��"�"�C������V�S�^�^�%�c�i�i�[�����4�@�B������V�S�^�^�%�c�i�i�[��#�)�)��=�?������[�#�.�.�%�c�i�i�[��#�)�)��=�}�N��
rc	#��K�tj�5}tjj	|�}|rRtjjtjj
||��}tj|�tr�ddl	}tjj|j�}tj|�D]g}|j|d�s�tjtjj
||�tjj
||���itjj
|tjj|j��}tj|j|�tj |j|�||_|��ddd�y#1swYyxYw�w)Nrz*.dll)�tempfile�TemporaryDirectoryrr�realpath�normpathr0�makedirsr�fnmatchr-r1�listdirr�copyfiler�copystat)r7�subdir�tmpdirr)�exedir�f�	exec_copys       r�tmpdir_with_pythonz"InitConfigTests.tmpdir_with_python!s,�����
(�
(�
*�f��W�W�%�%�f�-�F�����)�)�"�'�'�,�,�v�v�*F�G�����F�#�����������7�����F�+�A����q�'�2���������V�Q�(?������f�VW�AX�Y�,�
�����V�R�W�W�-=�-=�d�m�m�-L�M�I��O�O�D�M�M�9�5��O�O�D�M�M�9�5�%�D�M��L�/+�
*�
*�s$�G$�CG�)C&G�	G$�G!�G$c	���|j�}|dd}tjjj	|�}|D]�}tjj|�s�#tjj
tjj	|d��s�atjj|�}n|jd|���x}}trGtjj	|d�}|dtjj	|d�|g}	n|tjj�dtjj��}
tjj	|tjd	|
���}|j||�
�}	||	||||||d�}|j!|�||d�}|j#d
|t$|��y)Nrfrr�Unable to find home in �Libr�DLLsrr
�rr�rrrrrrrr��TESTHOMEr��test_init_setpythonhome�rqr#)rgrrr�r0�isdirr2r-r^rr.rr r!rrrr�rk)r7rfrt�	paths_strrrrr�stdlib�expected_paths�versionr#s            rr;z'InitConfigTests.test_init_setpythonhome=s����*�*�,���x� �!6�7���G�G�O�O�(�(��/�	��D��7�7�=�=��&���w�w�~�~�b�g�g�l�l�4��9�:��w�w���t�,����
�I�I�/��y�9�:�#�#�����W�W�\�\�$��.�F�$�A�h������T�6�(B�F�K�N��)�)�/�/�0��#�2B�2B�2H�2H�1I�J�G��W�W�\�\�$����&��	�8J�K�F�!�5�5�T�t�5�T�N��#1��!�&� +�'� �	
��	
�!�!�&�)��y�9�����8�&�#-�3�	�	8rc	�6�|j�}|dd}tjjj	|�}|D]�}tjj|�s�#tjj
tjj	|d��s�atjj|�}n|jd|���x}}trGtjj	|d�}|dtjj	|d�|g}	n|tjj�dtjj��}
tjj	|tjd	|
���}|j||�
�}	||	||||||d�}||d�}d
|d<d|d<|j!d|t"|��d|d<d|d<tjjtj$�}t'tjj	|d�d��5}
tjj)tjj	||
j+��d�j-�d��|	trdnd<ddd�ts?tj.x}}|j|��d|	d<|j1||||��|j!d|t"|��y#1swY�hxYw)Nrfrrr4r5rr6rr
r7r8r9�1�NEGATIVE_ISPYTHONBUILDr7�test_init_is_python_buildr<rzr�pybuilddir.txtr�r�z
$r	)r)rrrr)rgrrr�r0r=r2r-r^rr.rr r!rrr�rkr/r�r'r�r`rr�)r7rfrtr>rrrrr?r@rAr#r/r0s              r�#test_init_is_python_build_with_homez3InitConfigTests.test_init_is_python_build_with_homefs����*�*�,���x� �!6�7���G�G�O�O�(�(��/�	��D��7�7�=�=��&���w�w�~�~�b�g�g�l�l�4��9�:��w�w���t�,����
�I�I�/��y�9�:�#�#�����W�W�\�\�$��.�F�$�A�h������T�6�(B�F�K�N��)�)�/�/�0��#�2B�2B�2H�2H�1I�J�G��W�W�\�\�$����&��	�8J�K�F�!�5�5�T�t�5�T�N��#1��!�&� +�'� �	
�� �y�9��(+��$�%�%&��!�"����:�F�#-�3�	�	8�),��$�%�%&��!�"���������0��
�"�'�'�,�,�v�'7�8�6�
J�a�57�W�W�5E�5E������V�����z��%5�%@�%@�%B�1�%E�F�6H�N�
�1��2�K��#&�:�:�-�F�[� $� 8� 8�� 8� G�� J�N�1���M�M��V�&1�K�
�
Q����:�F�#-�3�	�	8�K�
J�s
�=A+L�Lc��|j�}|dd}tjjj	|�}||d<d|i}|S)Nrfrrr�)rgrrr�r0)r7rf�all_configsrtr>r#s      r�copy_paths_by_envz!InitConfigTests.copy_paths_by_env�sR���/�/�1���H�%�&;�<���G�G�O�O�(�(��/�	�#,��� ��Y�'���
rzSee test_init_pybuilddir_win32c	��|j�5}tjd�xsd}d}tjj||�}tjj
tjj||d��}tj|�tjj|d�}t|dd��5}|j|�ddd�|j�}||d	<||d
<|j}	tjd�tjd�|	|	||d
�}
|j|
�}|jd|
t|d|��ddd�y#1swY��xYw#1swYyxYw)N�VPATHr*�libdirr5rF�wr�r����r�rr)rrrr/rrr�T�rqr#r�rE)r2�	sysconfig�get_config_varrrr0r'�mkdirr��writerr1rJr�rk)r7r.�vpathr-rM�	stdlibdir�filenamer�rr/rfr#s            r�test_init_pybuilddirz$InitConfigTests.test_init_pybuilddir�sU���
$�
$�
&�&��,�,�W�5�;��E��F��W�W�\�\�&�&�1�F����(�(������f�e�U�)K�L�I��H�H�V���w�w�|�|�F�,<�=�H��h��f�5������ �6�#'�":�":�"<��&/���#�&,���#����J�$-�$<�$<�]�$K�(�7�7��A�#-�(�':�'�
�F��(�(��0�C��"�"�#<�f�'1�s�15�6�
#�
C�9'�
&�6�5��'�
&�s%�B=E>�E2� B	E>�2E;	�7E>�>FzSee test_init_pybuilddirc
��tjd�}d}tjj	|�jtj�dk(r tjj|d�}|j|�5}tjj	tjj||��}tjj	tjj||d��}tjj|d�}t|dd�	�5}|j|�ddd�|j�}tjj|tjj|d
��|d
<||d<||d<|j}	|||	|	||||d
�}
|j|
�}|jd|
t |d|��ddd�y#1swY��xYw#1swYyxYw)NrLzPCbuild\archr	�instrumentedr5rFrNr�r����rOr�)rrrr/rrrrr�FrP)rQrRrrr'�count�sepr0r2r�rTrrr1rJr�rk)r7rUr-r.rrVrWr�rr/rfr#s            r�test_init_pybuilddir_win32z*InitConfigTests.test_init_pybuilddir_win32�s����(�(��1�� ��
�7�7���E�"�(�(����0�A�5��W�W�\�\�&�.�9�F�
�
$�
$�V�
,���W�W�%�%�b�g�g�l�l�6�5�&A�B�F����(�(������f�e�U�)K�L�I��w�w�|�|�F�,<�=�H��h��f�5������ �6�#'�":�":�"<��&(�g�g�l�l�6�2�7�7�;K�;K�L_�`b�Lc�;d�&e���#�&,���#�&/���#����J�$*�%�#-�(� �%�':�'�	�F��(�(��0�C��"�"�#<�f�'1�s�16�F�
#�
D�7-�
,�6�5��-�
,�s&�B*H�2G5�B(H�5G>	�:H�H
c
��|j�5}tj�5}tj}t
s`tjj|tjd|j�d|j��d�}t
j|�n�tjj|d�}t
j|�tjtjjtj d�tjj|d��tjj|d�}t#|dd�	�5}t%d
|z|��t%d|��ddd�|j'�}t
s|d
<natjj|tjj)|d��|tjj|d�g}|j*}	tjj|tjj)|	��}
|}t-j.d�|||
|	|d�}t
rK||d<||d<tjj|d�|d<t1tj2�|d<n,|j4|d<t1tj2�|d<|j7|�}
|j9d|t:|
d|��ddd�ddd�y#1swY���xYw#1swY�xYw#1swYyxYw)Nr
rrr5rz
pyvenv.cfgrNr�r�z	home = %s��filez$include-system-site-packages = falser�rr)rrrrr/rrrr5r�TrP)r2r$r%r.rrrrr0rr r!r(rr+r�
STDLIB_DIRr�rTrrr1rQrRrrrlrJr�rk)r7r.�pyvenv_homer"�lib_dynload�
lib_folderrWr�rtr/rrrfr#s              r�test_init_pyvenv_cfgz$InitConfigTests.test_init_pyvenv_cfg�s����
$�
$�
&�&�
�
(�
(�
*�k��"�"�C�� �g�g�l�l�;�+.�>�>�-3�C�I�I�;�a��	�	�{�+K�+8�:�����K�(��W�W�\�\�+�u�=�
����J�'�����G�G�L�L��!3�!3�W�=��G�G�L�L��W�5��
�w�w�|�|�F�L�9�H��h��f�5���k�K�/�b�9��<�2�F�6��,�,�.�E��'��b�	��G�G�L�L�����)9�)9�%��(�)C�D���G�G�L�L��e�4������J� �g�g�l�l�;����8H�8H��8T�U�O�%�K�(�7�7��A�$/�*�#2�(�',�
�F��(3��}�%�#.��x� �')�w�w�|�|�K��'G��|�$�/2�w�7G�7G�3G�/H��+�,�(,�'9�'9��|�$�/2�w�7G�7G�3G�/H��+�,��(�(��0�C��"�"�#<�f�'1�s�15�6�
#�
C�q+�'�
&�(6�5��'+�
*��'�
&�s<�L=�D:L1� L$�>FL1�L=�$L.�)L1�1L:	�6L=�=Mzspecific to Windowsc	���ddddddtj��d�fg}|jdit��d	tjj
j
d
�|D��i���\}}|j|d�	tj|�}|dd}t||�D]\\}}}|j||��y#tj$r|jd
|���Y�[wxYw)N)z	C:/a. . .�	C:\a. . .)rhrh)z\\?\C:////a////b. . .z\\?\C:\a\b. . .)z//a/b/c. . .�\\a\b\c. . .)ririza. . .z\ar�r�c3�&K�|]	}|d���y�w)rNrv)�.0�cs  r�	<genexpr>z=InitConfigTests.test_getpath_abspath_win32.<locals>.<genexpr>Fs����3H�%�Q�A�a�D�%�s�r�r*rZrfr)
rr4r[r%rr�r0rUr�r�r]r^�zip)r7�CASESrYrZr�r�r�r�s        r�test_getpath_abspath_win32z*InitConfigTests.test_getpath_abspath_win326s
��
)�(�@�0�4�
�"�)�)�+��c�*�+�

���0�0�)�J�(�*�J��r�w�w���3�3�3H�%�3H�H�J�1�
���S�
	
����b�!�	9��*�*�S�/�C��h�-� 5�6��%(���%8�!�M�Q��6����V�X�.�&9��	�#�#�	9��I�I�/��w�7�8�	9�s�C�'C6�5C6c�p�
�tjd��
tjd�}�
fd�}|d�}|d�}|d�}|d�}|d�}|d	�}|j�d
}	|j|�j	t
jj�|	d�|j|�|	d�|j|�|	d
�|j|�|	d�|j|�|	d�|j|�|	d�y)N�ctypes�_testinternalcapic�d��t�j|�}d|_�j|_|S)Nrv)�getattr�	pythonapi�argtypes�	c_wchar_p�restype)r�funcrrs  �r�get_funcz8InitConfigTests.test_global_pathconfig.<locals>.get_funcas.����6�+�+�T�2�D��D�M�!�+�+�D�L��Kr�
Py_GetPath�Py_GetPrefix�Py_GetExecPrefix�Py_GetProgramName�Py_GetProgramFullPath�Py_GetPythonHomerfrrrrr/r)r�
import_module�get_configsrUr�rrr�)r7rsr{r|r}r~rr�r�rfrrs          @r�test_global_pathconfigz&InitConfigTests.test_global_pathconfigRs-����,�,�X�6��)�7�7�8K�L��	��l�+�
���/��#�$6�7��$�%8�9�� (�)@� A��#�$6�7��"�.�.�0��:�������+�+�B�G�G�O�O�<�� 5�6�	8��������)9�:����)�+�V�M�-B�C����*�,�f�^�.D�E����.�0�&��2F�G����)�+�V�F�^�<rc�r�gd�}tt��}ddd|gd�d�}|jd||t��y)N)zignore:::PyConfig_Insert0r+z
ignore:::env1z
ignore:::env2zignore:::cmdline1zignore:::cmdline2r�zignore:::PySys_AddWarnOption1zignore:::PySys_AddWarnOption2zignore:::PyConfig_BeforeReadzignore:::PyConfig_AfterReadr�r)r�z-Wignore:::cmdline1z-Wignore:::cmdline2)r�rrrr�test_init_warnoptionsr�)rr�r�r�)r7rr�rfs    rr�z%InitConfigTests.test_init_warnoptionsxsM��+���#8�9�	����&�1�
��	
���6��	�#-�	�	/rc�B�dddgd�}|jd|t��y)Nrr	zerror::BytesWarning)r4rr�test_init_set_configr�r�r�s  rr�z$InitConfigTests.test_init_set_config�s2����1�2�
��
	
���5�v�#/�	�	1rc�&�|jd�y)N�test_get_argc_argv�r[r@s rr�z"InitConfigTests.test_get_argc_argv�s���%�%�&:�;rc
���hd�}|D]c\}}d|��}ddgdd|ddgddd	|g|d
�}|rd|d	dind}|jt|��5|jd|t|�
�ddd��ey#1swY�pxYw)N>�z=onr�z=offr�r*r�rSr�frozen_modulesr	rYr
r�r�r�r)r�rrrr.r�rr5�
TESTFROZEN�test_init_use_frozen_modulesr<)r��reprr�r�)r7�tests�rawr��optvalrfr#s       rr�z,InitConfigTests.test_init_use_frozen_modules�s���
��#�M�C��%�c�U�+�F����'��v�t�V�D� )�'�#$�#�H�&.�	�F�.1�<��Q�R��)�d�C����d�3�i�(��&�&�'E�v�+5�3�'�@�)�(�#�)�(�s�	A.�.A7	c�4�d}d}d}d}d}d}||z|z|z|zdd�}|jd	�\}}	|j|	d
�	tj|�}|j||�y#tj$r|jd|���Y�<wxYw)N� �iii�iT)�
feature_flags�own_gil�#test_init_main_interpreter_settingsr*rZ)r[rUr�r�r]r^)
r7�OBMALLOC�
EXTENSIONS�THREADS�DAEMON_THREADS�FORK�EXECr�rYrZs
          rr�z3InitConfigTests.test_init_main_interpreter_settings�s������
����������4��$�&��0�>�A��	
���0�0�1�
���S�	
����b�!�	9��*�*�S�/�C�	
����h�'���#�#�	9��I�I�/��w�7�8�	9�s�A-�-'B�Br?)NNNN)NN)]rsrtrur�rrm�objectrjrlrk�PYMEM_ALLOCATOR_NOT_SETr�r�rr�r�r�r�ror.�int_info�default_max_str_digitsrrrr�r�r�rr�r�rKrP�classmethodrQrWr`rgrurwr|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��skipr�r�rrrr
rrrr�
contextlib�contextmanagerr2r;rGrJ�skipIfrX�
skipUnlessr^rfrpr�r�r�r�r�r�rvrrr�r��s����G�+5��;L�� ����H�M�#�,���� !������ � �(�!�"
�	��.���*�$�	���0�!����������O�J��
�J��A�J�	�1�J�	�A�	J�	"�1�
J�	��J�	�Q�J�	�c�l�l�A�A�J�	��J�	�q�J�	�!�J�	�q�J�	�Q�J�	�!�J� 	�Q�!J�"	��#J�&	�1�'J�(	�/�)J�,	�$�-J�.	�*�/J�0	�a�1J�2	���3J�4	�R�5J�8	�B�9J�:	�r�;J�>	�$�?J�@	��AJ�B	�(�CJ�D	�-�EJ�H	�$�IJ�J	�)�KJ�L	�)�MJ�N	�.�OJ�P	�1�QJ�R	"�1�SJ�T	�c�n�n�UJ�V	�(�WJ�Z	�q�[J�\	��]J�^	 ��_J�`	�1�aJ�b	�q�cJ�d	�a�eJ�f	��gJ�h	�!�iJ�j	�1�kJ�l	��mJ�n	�q�oJ�p	�Q�qJ�r	�!�sJ�v	�,�wJ�x+�"#����� )� ��")�"2�"2�2��)�SJ�M�V����"�A�
�	�������M�
�=�!������ !������
�O��23��.�/�,-�$%�01���	%�����(��%�%�'
�	�	�!�!�#
�	��O��#��#��<�>�"6:�=8�~/�
+�=�,;?�-1�)-�!%�4�>B�"�%�T�	4�lN�M�J�/�.>/�@/�@/�B/�/�
/�/�&1�$R�Q�Q�Q�N�M�J�/��X�]�]�<�=�;�=�;�L�(
M�S�"	O�/�� 3�,L�2�&������6'8�R:8�x��X�_�_�Z�!A�B�!C�C�!C�F�X����%?�@�%D�A�%D�N>C�@�X����%:�;�/�<�/�6$=�L/�61�<�@�0(rr�c��eZdZd�Zy)�SetConfigTestsc���tjd�tjdddddg}t	j
|tjtjdd�	�}|jr:tjr*t|j�t|j�|j|jd
|j|j|jf�y)N�	_testcapir�r�r�z-mztest._test_embed_set_configr��backslashreplace)rHrIr�r�r)rr�r.r/rMr|rOrCrrSrTrHrIrU)r7rWr_s   r�test_set_configzSetConfigTests.test_set_config�s����#�#�K�0��~�~�t�V�T�4�9V�W���~�~�c�%/�_�_�%/�_�_�'.�7I�K���?�?�w����$�+�+���$�+�+��������!��/�/�4�;�;����D�	FrN)rsrtrur�rvrrr�r��s��Frr�c�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�
AuditingTestsc�&�|jd�y)N�test_open_code_hookr�r@s rr�z!AuditingTests.test_open_code_hook�s���%�%�&;�<rc�&�|jd�y)N�
test_auditr�r@s rr�zAuditingTests.test_audit�s���%�%�l�3rc�&�|jd�y)N�test_audit_subinterpreterr�r@s rr�z'AuditingTests.test_audit_subinterpreter�����%�%�&A�Brc�H�|jdtjd��y)N�test_audit_run_commandr�rBrC�r[r�
SHORT_TIMEOUTr@s rr�z$AuditingTests.test_audit_run_command�s$���%�%�&>�.5�.C�.C�12�	&�	4rc�H�|jdtjd��y)N�test_audit_run_filerr�r�r@s rr�z!AuditingTests.test_audit_run_file�s$���%�%�&;�.5�.C�.C�12�	&�	4rc��tjj|jtj
�dz}t
|dd��5}td|��td|��ddd�	it��d|i�}|jd	tjd
|��tj|�y#1swY�SxYw#tj|�wxYw)N�.pyrNr�r�z
import sysr`z&sys.__interactivehook__ = lambda: None�
PYTHONSTARTUP�test_audit_run_interactivehook�
�rBrCr#�
rrr0r5r�TESTFNr�rTr%r[rr��unlink�r7�startupr0r#s    rr�z,AuditingTests.test_audit_run_interactivehook�s����'�'�,�,�t�{�{�I�,<�,<�=��E��
�'�3��
1�Q��,�Q�'��:��C�2�	�G�*�,�G�o�w�G�C��)�)�*J�29�2G�2G�57�S�
*�
B�
�I�I�g��2�
1��
�I�I�g��s�
B7�.3C�7C�Cc��tjj|jtj
�dz}t
|dd��5}td|��ddd�	it��d|i�}|jdtjd	|�
�tj|�y#1swY�SxYw#tj|�wxYw)Nr�rNr�r�r�r`r��test_audit_run_startupr�r�r�r�s    rr�z$AuditingTests.test_audit_run_startups����'�'�,�,�t�{�{�I�,<�,<�=��E��
�'�3��
1�Q��&�q�!�2�	�G�*�,�G�o�w�G�C��)�)�*B�29�2G�2G�57�S�
*�
B�
�I�I�g��2�
1��
�I�I�g��s�
B*�!3B6�*B3�6C
c�H�|jdtjd��y)N�test_audit_run_stdinrr�r�r@s rr�z"AuditingTests.test_audit_run_stdins$���%�%�&<�.5�.C�.C�12�	&�	4rc�&�|jd�y)N�test_get_incomplete_framer�r@s rr�z'AuditingTests.test_get_incomplete_framer�rN)rsrtrur�r�r�r�r�r�r�r�r�rvrrr�r��s1��=�4�C�4�
4�
�
�4�
Crr�c��eZdZd�Zej
ejdk(d�d��Zeje
jd�d��Zy)�	MiscTestsc�&�|jd�y)N�test_unicode_id_initr�r@s rr�zMiscTests.test_unicode_id_inits��	
�%�%�&<�=r�ntz(Py_FrozenMain is not exported on Windowsc��ttj�}d|d<|jd|��\}}tjjd�}t
jd|�d��j�}|j||�y)NrC�PYTHONUNBUFFERED�test_frozenmainr�r
z�
            Frozen Hello World
            sys.argv ['./argv0', '-E', 'arg1', 'arg2']
            config program_name: ./argv0
            config executable: z|
            config use_environment: 1
            config configure_c_stdio: 1
            config buffered_stdio: 0
        )
rrr r[rr&r�r��lstriprU)r7r#rYrZr/r�s      rr�zMiscTests.test_frozenmains����2�:�:���"%�����0�0�1B��0�L���S��W�W�%�%�i�0�
��?�?�( �!+�|�,	�	$�
��V�X�	�	
����h�'rz--X showrefcount requires a Python debug buildc	��d}|D�]0\}}d|��}tjdddd|d|g}tj|tjtj
d��}|j
|jd	�|jj�}tjd
|�}|s|jd|���t|jd��}	t|jd
��}
|j||��5|j
|	d	|�|j
|
d	|�ddd���3y#1swY��?xYw)N))�offr�)�onr�)r��import __hello__)r�r�zfrozen_modules=r�r��showrefcountrYT)rHrIr�rz!^\[(-?\d+) refs, (-?\d+) blocks\]zunexpected output: rr	)r��stmt)r.r/rMr|rO�STDOUTrUrCrHr�rdrer^r�groupr�)r7r��flagr��xoptrWr_rYre�refs�blockss           r�test_no_memleakzMiscTests.test_no_memleak0s��
�� �J�D�$�$�T�F�+�D��>�>�4��~�t�T�4�QU�V�C��>�>�#�)3���)3�):�):�'+�-�D�
���T�_�_�a�0��+�+�$�$�&�C��H�H�A�3�G�E���	�	�/��w�7�8��u�{�{�1�~�&�D�����Q��(�F����T���=�� � ��q�#�.�� � ���C�0�>�=� �>�=�s�'D:�:E	N)
rsrtrur�r�r�rrr�r�rrr�rvrrr�r�sc��>��X�_�_�R�W�W��_�?�A�(�A�(� �X����)�)�H�J�1�J�1rr�c�(�eZdZdZd�Zd�Zd�Zd�Zy)�StdPrinterTestsrc��tjd�}|jj}|jf|_|j|_||�S)Nrr)rr�rv�PyFile_NewStdPrinter�c_intrw�	py_objectry)r7�fdrrr�s    r�create_printerzStdPrinterTests.create_printerTsM���,�,�X�6��%�/�/�D�D��)/�����%�'-�'7�'7��$�#�B�'�'rc�|�d}|j}tj|�}|jtj|�tj
�\}}|jtj|�|jtj|�	tj||�|j|�}|j|�tj||�tj|d�}|j||jdd��y#tj||�wxYw)Nuunicode:é-€-�!
�dr�r�)�	STDOUT_FDr�dup�
addCleanup�close�pipe�dup2r�rTr�rU�encode)r7�message�	stdout_fd�stdout_fd_copy�rfd�wfd�printer�datas        r�
test_writezStdPrinterTests.test_write[s���1���N�N�	����	�*��������.�1��7�7�9���S�������#�&�������#�&�	/�
�G�G�C��#��)�)�)�4�G��M�M�'�"��G�G�N�I�.��w�w�s�C� ������w�~�~�f�6H�I�J��
�G�G�N�I�.�s�8D#�#D;c�$�|j}|j|�}|j|j�|�|j|j	�tj|��|j
�|j�yr?)r�r�rU�fileno�isattyr�flushr��r7r�rs   r�test_methodszStdPrinterTests.test_methodsrsc��
�^�^���%�%�b�)��������)�2�.�������)�2�9�9�R�=�9��
�
���
�
�rc�|�|j}|j|�}tj|t	|��yr?)r�r�r�check_disallow_instantiation�typers   r�test_disallow_instantiationz+StdPrinterTests.test_disallow_instantiationzs/��
�^�^���%�%�b�)���,�,�T�4��=�ArN)rsrtrur�r�rr	r
rvrrr�r�Ms��
�I�(�K�.�Brr��__main__)6�testr�test.supportrrrr��collectionsrr��ior�r�os.pathrdrrMr.rQr$r��has_subprocess_supportr��platformrr�r�r�rkr�r�r��
MAX_HASH_SEEDrr0rrrr r!�STDLIB_INSTALL�isfilerr%r'�TestCaserxr�r�r�r�r�rsrqrvrr�<module>rs����=�=��"��	��	��	�
��
�����%�%�
�(�
�
�=�
>�>�	����	!���������
�
�
���
�
��
�
�����c�j�j�#�.�.��S�
�
�
#�
#�$�A�c�&6�&6�&<�&<�%=�>�@��	�w�w�~�~�b�g�g�l�l�>�7�;�<��N�5��j!�j!�Z\5�(�(�*;�*;�\5�~E(�)�8�+<�+<�E(�P(
F�X�&�&�
F� 3C�'��):�):�3C�l31�#�X�%6�%6�31�l0B�)�8�+<�+<�0B�f�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists