%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/test/support/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/test/support/__pycache__/__init__.cpython-312.pyc

�

���f�8��<
�dZedk7red��ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZgd�ZdZdZdZd	Zej,j/ej,j1e��Zej,j/e�Zej,j/e�Zej,j/e�ZGd
�de�ZGd�d
e�Z Gd�de �Z!Gd�de�Z"Gd�dejF�Z$d�Z%d�Z&d�Z'dZ(dZ)da*da+dZ,dZ-da.d�Z/d�Z0d�Z1d�Z2d�Z3d�d�Z4d�Z5d �Z6d!�Z7d"�Z8d�d#�Z9ddddd$�d%�Z:d�ddddd$�d&�Z;e:d'�(�Z<d)�Z=d*�Z>d+Z?d,Z@ej�eBj�d-�j�d.�d/�ZEd�d0�ZFd�d1�ZGd�d2�ZHd�d3�ZId4�ZJd�d5�ZKd6�ZLe
j�d7k(ZNe
j�j�d8�ZOePe
d9�ZQe
j�d:vreQrd;nd<ZRndZRe
j�d=k(ZSe
j�d>k(ZTePed?�xreSxreTZUd@�ZVeSxreTZWdA�ZXeSxreTZYddB�dC�ZZdZ[e
j�d7k7r	e
j�dD�dDk7Z[dEZ^dZ_dZ`ej,j�edF�ZbdG�Zcd�dH�ZddI�ZedJefdKegefehffdL�Zid�dddM�dN�ZjdO�Zkej�dP��ZmdQ�ZndR�ZodS�ZpdT�Zqej�dU��ZrdV�ZsdW�ZtdXZudYZvePe
dZ�rd[euzZud\Zveud]zZwd^�Zxd_�Zyd`ZzdaZ{db�Z|ej�dc��Z}dd�Z~deZdfezZ�dge�zZ�dhe�zZ�e
�jZ�diefdKe�fdj�Z�diefdKdfdk�Z�Gdl�dm�Z�d�dn�Z�do�Z�dp�Z�dq�Z�dr�Z�d�ds�Z�dt�Z�du�Z�dv�Z�dw�Z�dx�Z�dy�Z�dz�Z�e��xr%e
j�d7k7xre�j,d{�Z�e�jduxre�Z�ej�e�d|�Z�d}�Z�d~�Z�e
�j8e�_�da�d�Z�ej�d���Z�ej�d���Z�d��Z�d��Z�Gd��d�eh�Z�da�d��Z�Gd��d��Z�d��Z�d�d��d��Z�		d�d��Z�d�d��Z�Gd��d��Z�d��Z�ej�d���Z�d��Z�dd��d��Z�d��Z�d�d��Z�gfd��Z�da�d��Z�d��Z�ej�d���Z�Gd��d��Z�d��Z�Gd��d��Z�e��Z�Gd��d��Z�e��Z�e�j|Gd��d���Z�e��Z�e�j|Gd��d���Z�e��Z�d��Z�e
�j��j�Z�e�d�vsJ�d��Z�Gd��d��Z�dd��d��Z�d��Z�d��Z�d��Z�d��Z�ej�d���Z�d�d��Z�d�efd�efdKehfd��Z�d�ehdKdfd��Z�d��Z�e�j�d���Z�ej�d���Z�ePe
d��Z�d��Z�d�d'd��d��Z�d�d�d�d'dœdÄZ�ej�dĄ�Z�d�Z�e�reTrd�Z�n`d�Z�n]eTrd�Z�nXePedȫr#e�j���j�d�k(rd�Z�n,e
j�j�d˫rd�Z�ne:d'�(�rd�Z�nd�Z�e�j�ePedȫxr e�j���j�d�k(dϫZ�e�d�d�h�Z�d҄Z�y#e]$rY��wxYw)�z7Supporting definitions for the Python regression tests.ztest.supportz.support must be imported from the test package�N)P�
PIPE_MAX_SIZE�verbose�
max_memuse�
use_resources�failfast�Error�
TestFailed�
TestDidNotRun�ResourceDenied�record_original_stdout�get_original_stdout�captured_stdout�captured_stdin�captured_stderr�is_resource_enabled�requires�requires_freebsd_version�requires_linux_version�requires_mac_ver�check_syntax_error�
requires_gzip�requires_bz2�
requires_lzma�
bigmemtest�bigaddrspacetest�cpython_only�
get_attribute�requires_IEEE_754�
requires_zlib�has_fork_support�
requires_fork�has_subprocess_support�requires_subprocess�has_socket_support�requires_working_socket�anticipate_failure�load_package_tests�detect_api_mismatch�check__all__�skip_if_buggy_ucrt_strfptime�check_disallow_instantiation�check_sanitizer�skip_if_sanitizer�requires_limited_api�requires_specialization�
MS_WINDOWS�	is_jython�
is_android�
is_emscripten�is_wasi�check_impl_detail�
unix_shell�setswitchinterval�get_pagesize�open_urlresource�
reap_children�run_with_locale�	swap_item�findfile�infinite_recursion�	swap_attr�Matcher�set_memlimit�SuppressCrashReport�sortdict�run_with_tz�PGO�missing_compiler_executable�	ALWAYS_EQ�NEVER_EQ�LARGEST�SMALLEST�LOOPBACK_TIMEOUT�INTERNET_TIMEOUT�
SHORT_TIMEOUT�LONG_TIMEOUT�Py_DEBUG�EXCEEDS_RECURSION_LIMIT�C_RECURSION_LIMIT�
skip_on_s390xg$@gN@g>@g�r@c��eZdZdZy)rz*Base class for regression test exceptions.N��__name__�
__module__�__qualname__�__doc__���,/usr/lib/python3.12/test/support/__init__.pyrrks��4rZrc�.��eZdZdZdd��fd�
Zd�Z�xZS)r	�Test failed.N��statsc�B��||_||_t�|�|g|���y�N)�msgr_�super�__init__)�selfrbr_�args�	__class__s    �r[rdzTestFailed.__init__ps#��������
�
����$�t�$rZc��|jSra)rb�res r[�__str__zTestFailed.__str__us���x�x�rZ)rUrVrWrXrdrj�
__classcell__�rgs@r[r	r	ns����)-�%�
rZr	c�"��eZdZdZ�fd�Z�xZS)�TestFailedWithDetailsr]c�H��||_||_t�|�
||||��y)Nr^)�errors�failuresrcrd)rerbrprqr_rgs     �r[rdzTestFailedWithDetails.__init__zs'������ ��
�
����f�h�e��<rZ)rUrVrWrXrdrkrls@r[rnrnxs����=�=rZrnc��eZdZdZy)r
zTest did not run any subtests.NrTrYrZr[r
r
s��(rZr
c��eZdZdZy)rz�Test skipped because it requested a disallowed resource.

    This is raised when a test calls requires() for a resource that
    has not be enabled.  It is used to distinguish between expected
    and unexpected skips.
    NrTrYrZr[rr�s��rZrc�,�|rtjSd�S)z�Decorator to mark a test that is known to be broken in some cases

       Any use of this decorator should have a comment identifying the
       associated tracker issue.
    c��|SrarY)�fs r[�<lambda>z$anticipate_failure.<locals>.<lambda>�s��Q�rZ)�unittest�expectedFailure)�	conditions r[r&r&�s����'�'�'��rZc�d�|�d}t}|j|||��}|j|�|S)z�Generic load_tests implementation for simple test packages.

    Most packages can implement load_tests using this function as follows:

       def load_tests(*args):
           return load_package_tests(os.path.dirname(__file__), *args)
    ztest*)�	start_dir�
top_level_dir�pattern)�
STDLIB_DIR�discover�addTests)�pkg_dir�loader�standard_testsr~�top_dir�
package_testss      r[r'r'�sD�������G��O�O�g�29�,3�$�5�M����M�*��rZc�p�	t||�}|S#t$rtjd|�d|����wxYw)z?Get an attribute, raising SkipTest if AttributeError is raised.zobject z has no attribute )�getattr�AttributeErrorrx�SkipTest)�obj�name�	attributes   r[rr�sD����C��&�	�����O����3�� M�N�N�O�s��%5�Fc��|ayra)�_original_stdout)�stdouts r[rr�s���rZc�2�txstjSra)r��sysr�rYrZr[r
r
�s���)�s�z�z�)rZc��	||�S#t$r3}tdk\r$t|jj�d|����d}~wt
$rz}tdk\r>t|jj�d|���td|j�|���t
j|tj�||�cYd}~Sd}~wwxYw)N��: zre-run )
�FileNotFoundErrorr�printrgrU�OSError�os�chmod�stat�S_IRWXU)�path�funcrf�errs    r[�
_force_runr��s�����T�{������a�<��c�m�m�4�4�c�:�;�
�����a�<��c�m�m�4�4�c�:�;��4�=�=�$�7�8�
����t�|�|�$��T�{����s%��	C�.>�C�
A/B?�9C�?Cc	����ttd�rtjSddl}d}tjjd�r|j
�rd}�n�tjjd�r�ddl�ddl�d}d}G�fd�d�j�}�jj}|j�}|s�j��|�}�jj�}|j!||�j#|��j%|��j#|��}	|	s�j��t'|j(|z�s�d}n�tjd	k(r�dd
lm}
m�m}m	}ddlm}
|
j5|
d��}|j7�dk(rd
}nFG�fd�d|�}|�}||�}|j9|�dks|j;|�dkrd}|s>	ddlm}|�}|jA�|jC�|jE�|t_)|t_tjS#tF$rP}tI|�}tK|�dkDr|dddz}djMtO|�jP|�}Yd}~�{d}~wwxYw)N�resultr�winz(gui is not available on Windows IoT Corer�c���eZdZdW�jjfdW�jjfdW�jj
fgZy)�*_is_gui_available.<locals>.USEROBJECTFLAGS�fInherit�	fReserved�dwFlagsN)rUrVrW�wintypes�BOOL�DWORD�_fields_)�ctypess�r[�USEROBJECTFLAGSr��s@���#�V�_�_�%9�%9�:�$�f�o�o�&:�&:�;�"�F�O�O�$9�$9�:�<�HrZr�z,gui not available (WSF_VISIBLE flag not set)�darwin)�cdll�c_int�pointer�	Structure)�find_library�ApplicationServicesz0gui tests cannot run without OS X window managerc�"��eZdZdW�fdW�fgZy)�._is_gui_available.<locals>.ProcessSerialNumber�
highLongOfPSN�lowLongOfPSNN)rUrVrWr�)r�s�r[�ProcessSerialNumberr�s���,�e�4�+�U�3�5�rZr�z#cannot run without OS X gui process)�Tk�2z [...]zTk unavailable due to {}: {})*�hasattr�_is_gui_availabler��platformr��
startswith�win32_is_iotr��ctypes.wintypesr��windll�user32�GetProcessWindowStation�WinErrorr�r��GetUserObjectInformationW�byref�sizeof�boolr�r�r�r��ctypes.utilr��LoadLibrary�CGMainDisplayID�GetCurrentProcess�SetFrontProcess�tkinterr��withdraw�update�destroy�	Exception�str�len�format�typerU�reason)r�r��	UOI_FLAGS�WSF_VISIBLEr��dll�h�uof�needed�resr�r�r�r��app_servicesr��psn�psn_pr��root�e�
err_stringr�r�s                      @@r[r�r��s\���� �(�+� �'�'�'��
�F�
�|�|���u�%�(�*?�*?�*A�;��	���	 �	 ��	'�	���	���	<�f�.�.�	<��m�m�"�"���'�'�)����/�/�#�#�������&�&�(���+�+�A���L�L����M�M�#���L�L�� �	"��
��/�/�#�#��C�K�K�+�-�.�C�F�	����	!�	;�:�,��'�'��5J�(K�L���'�'�)�Q�.�G�F�
5�i�
5�&�'�C��C�L�E��1�1�%�8�1�<��/�/��6��:�>���	G�"��4�D��M�M�O��K�K�M��L�L�N� &���#)�z����#�#�#���	G��Q��J��:���#�'���_�x�7�
�3�:�:�4��7�;K�;K�;E�G�F��		G�s�=I%�%	J>�.AJ9�9J>c�&�tduxs|tvS)z�Test whether a resource is enabled.

    Known resources are set by regrtest.py.  If not running under regrtest.py,
    all resources are assumed enabled unless use_resources has been set.
    N)r��resources r[rr!s���D� �=�H�
�$=�=rZc��t|�s|�d|z}t|��|dvrtstd��|dk(r$t�sttj��yy)z@Raise ResourceDenied if the specified resource is not available.Nz"Use of the %r resource not enabled>�network�urlfetchzNo socket support�gui)rrr$r�r�)r�rbs  r[rr)sd���x�(��;�6��A�C��S�!�!��*�*�3E��0�1�1��5��!2�!4��.�5�5�6�6�"5�rZc�t�ddl}djtt|��}|j	�jdd�d}|j
�|k(r/	ttt|jd���}||k}nd}tj||�d|�d|���S#t$rd}Y�+wxYw)	z�Decorator raising SkipTest if the OS is `sysname` and the version is less
    than `min_version`.

    For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
    the FreeBSD version is less than 7.2.
    rN�.�-r�Fz	 version � or higher required, not )r��join�mapr��release�split�system�tuple�int�
ValueErrorrx�skipIf)�sysname�min_versionr��min_version_txt�version_txt�version�skips       r[�_requires_unix_versionr4s�����h�h�s�3��4�5�O��"�"�$�*�*�3��2�1�5�K�����G�#�	)��C��[�%6�%6�s�%;�<�=�G��[�(�D����?�?���)�9�_�-�-F��-�	�����	��D�	�s�(B)�)B7�6B7c��td|�S)z�Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is
    less than `min_version`.

    For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD
    version is less than 7.2.
    �FreeBSD�r�r�s r[rrOs��"�)�[�9�9rZc��td|�S)z�Decorator raising SkipTest if the OS is Linux and the Linux version is
    less than `min_version`.

    For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux
    version is less than 2.6.32.
    �Linuxrrs r[rrXs��"�'�;�7�7rZc����fd�}|S)z�Decorator raising SkipTest if the OS is Mac OS X and the OS X
    version if less than min_version.

    For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version
    is lesser than 10.5.
    c�T���tj����fd��}�|_|S)Nc�V��tjdk(rddl}|j�d}	tt	t
|j
d���}|�kr:djt	t���}tjd|�d|�����|i|��S#t$rY�wxYw)Nr�rr�z	Mac OS X r�)r�r��mac_verr�r�r�r�r�r�rxr�r�)rf�kwr�r�rr�r�r�s      ��r[�wrapperz4requires_mac_ver.<locals>.decorator.<locals>.wrapperis�����|�|�x�'��&�.�.�0��3��	>�#�C��[�->�->�s�-C�$D�E�G���,�*-�(�(�3�s�K�3H�*I��&�/�/�.��=�>�>���$��$�$��"����s�(B�	B(�'B()�	functools�wrapsr�)r�rr�s` �r[�	decoratorz#requires_mac_ver.<locals>.decoratorhs-���	����	�	%�
�	%�*����rZrY)r�rs` r[rras����&�rZc��ddl}|sd}	|j�j�dk(}tj||�S#ttf$r*}tjd|�d�t�d}Yd}~�Jd}~wwxYw)z4Decorator raising SkipTest if running on a buildbot.rNznot suitable for buildbots�buildbotzgetpass.getuser() failed r�F)
�getpass�getuser�lower�KeyError�EnvironmentError�warnings�warn�RuntimeWarningrxr�)r�r�
isbuildbotr�s    r[�skip_if_buildbotr~st����-����_�_�&�,�,�.�*�<�
��?�?�:�v�.�.��
�&�'���
�
�1�#��a�8�.�I��
���s�!A�A:� A5�5A:��address�memory�ub�threadc��|s|s|s
|std��tjd�xsd}tjd�xsd}d|vxsd|v}d|vxsd|v}d	|vxsd
|v}d|vxsd|v}	|xr|xs|xr|xs|xr|xs|xr|	S)
z9Returns True if Python is compiled with sanitizer supportz:At least one of address, memory, ub or thread must be True�CFLAGS��CONFIG_ARGSz-fsanitize=memoryz--with-memory-sanitizerz-fsanitize=addressz--with-address-sanitizerz-fsanitize=undefinedz#--with-undefined-behavior-sanitizerz-fsanitize=threadz--with-thread-sanitizer)r��	sysconfig�get_config_var)
rr r!r"�cflags�config_args�memory_sanitizer�address_sanitizer�ub_sanitizer�thread_sanitizers
          r[r,r,�s����v��v��U�V�V��
%�
%�h�
/�
5�2�F��*�*�=�9�?�R�K��v�%�	1�!�[�0��
	��&�	2�"�k�1��
	�&�(�	=�-��<��
	�v�%�	1�!�[�0��

�	$�$�	&�	�	&�&�	&�	�	��	&�
�	$�$�	rZc�T�|sd}t||||��}tj||�S)z>Decorator raising SkipTest if running with a sanitizer active.z"not working with sanitizers activer)r,rxr�)r�rr r!r"rs      r[r-r-�s+���5���7�6�b��P�D��?�?�4��(�(rZT)rc�F�dD]}||vr||xxd|��z
cc<�|||<�y)N)�ASAN_OPTIONS�MSAN_OPTIONS�
UBSAN_OPTIONS�TSAN_OPTIONS�:rY)�env�optionr�s   r[�set_sanitizer_env_varr8�s5��Q����3�;���I�1�V�H��%�I��C��I�	rZc�B��tj���fd��}|S)z5Skip the test on TLS certificate validation failures.c���	�|i|��y#t$r(}dt|�vrtjd���d}~wwxYw)N�CERTIFICATE_VERIFY_FAILEDz.system does not contain necessary certificates)r�r�rxr�)rf�kwargsr�rvs   �r[�decz&system_must_validate_cert.<locals>.dec�sO���	�
�t��v����	�*�c�!�f�4��'�'�)A�B�B���		�s��	=�#8�=)rr)rvr=s` r[�system_must_validate_certr>�s%����_�_�Q������JrZi@i�double�IEEEztest requires IEEE 754 doublesc�Z�	ddl}tj||�S#t$rd}Y�#wxYw�Nr)�zlib�ImportErrorrx�
skipUnless)r�rCs  r[rr��5�������t�V�,�,����������*�*c�Z�	ddl}tj||�S#t$rd}Y�#wxYwrB)�gziprDrxrE)r�rIs  r[rr�rFrGc�Z�	ddl}tj||�S#t$rd}Y�#wxYwrB)�bz2rDrxrE)r�rKs  r[rr�s5�������s�F�+�+�������rGc�Z�	ddl}tj||�S#t$rd}Y�#wxYwrB)�lzmarDrxrE)r�rMs  r[rr�rFrGc��	ddl}|j	�}t|d�S#t$rtjd��wxYw)Nr�_testinternalcapi required�code_debug_ranges)�_testinternalcapirDrxr��
get_configr�)rQ�configs  r[�has_no_debug_rangesrT�sQ��>� ��
)�
)�
+�F��F�.�/�0�0�0���>���� <�=�=�>�s	�%�Ac�>�tjt�|�Sra)rxr�rT)r�s r[�requires_debug_rangesrVs���?�?�.�0�&�9�9rZc�^�	ddlm}tj|d�S#t$rd}Y�#wxYw)Nr��unicode_legacy_stringzrequires legacy Unicode C API)�	_testcapirYrDrxrErXs r[�requires_legacy_unicode_capir[s>��%�3����4�>�@�@���%� $��%�s��,�,�win32�java�getandroidapilevel)r\�vxworksz/system/bin/shz/bin/sh�
emscripten�wasi�forkc�6�tjtd�S)Nzrequires working os.fork())rxrEr rYrZr[r!r!!s�����/�1M�N�NrZc�6�tjtd�S)z3Used for subprocess, os.spawn calls, fd inheritancezrequires subprocess support)rxrEr"rYrZr[r#r#&s�����5�7T�U�UrZ)�modulec�v�d}|rtstj|��ytjt|�S)z�Skip tests or modules that require working sockets

    Can be used as a function/class decorator or to skip an entire module.
    zrequires socket supportN)r$rxr�rE)rerbs  r[r%r%-s;��
$�C�
�!��#�#�C�(�(�"��"�"�#5�s�;�;rZz%4Yzhttp://www.pythontest.net�datac���tjdk7ryddl}d}|�d�}|j�\}}t	|j|d��t	|�t	d|z�y)zOAssure user that loud errors generated by macOS libc's malloc are
    expected.r�Nrz NOTICE z� may generate "malloc can't allocate region"
warnings on macOS systems. This behavior is known. Do not
report a bug unless tests are also failing.
See https://github.com/python/cpython/issues/85100r�)r�r��shutil�get_terminal_sizer��center)�	test_namerirb�detail�padding�_s      r[�darwin_malloc_err_warningrpRsh���|�|�x����
�C���C�C�F�
�)�)�+�J�G�Q�	�#�*�*�W�c�
"�#�	�&�M�	�#��-�rZc�P�tjj|�r|S|� tjj||�}tgt
jz}|D]E}tjj||�}tjj
|�s�C|cS|S)a[Try to find a file on sys.path or in the test directory.  If it is not
    found the argument passed to the function is returned (this does not
    necessarily signal failure; could still be the legitimate path).

    Setting *subdir* indicates a relative path to use to find the file
    rather than looking directly in the path directories.
    )r�r��isabsr��
TEST_HOME_DIRr��exists)�filename�subdirr��dn�fns     r[r=r=es���
�w�w�}�}�X����
���7�7�<�<���1���?�S�X�X�%�D��)��
�W�W�\�\�"�h�
'��
�7�7�>�>�"��b�y�)��OrZc��t|j��}|D�cgc]}d|z��	}}dj|�}d|zScc}w)z%Like repr(dict), but in sorted order.z%r: %rz, z{%s})�sorted�itemsr�)�dictr{�pair�	reprpairs�
withcommass     r[rCrCxsG���4�:�:�<� �E�-2�3�T��D��3�I�3����9�%�J��J����4s�A�code�returnc�H�i}ttj|�|�|S)zHRun a piece of code after dedenting it, and return its global namespace.)�exec�textwrap�dedent)r��nss  r[�run_coder��s��	�B������	��#�
�IrZ)�lineno�offsetc�r�|jt|�5}t|dd�ddd�j}|j	|j
�|�|j
|j
|�|j	|j�|�|j
|j|�yy#1swY��xYw)Nz
<test string>r�)�assertRaisesRegex�SyntaxError�compile�	exception�assertIsNotNoner��assertEqualr�)�testcase�	statement�errtextr�r��cmr�s       r[rr�s���	�	#�	#�K��	9�4�R��	�?�F�3�4�
�,�,�C����S�Z�Z�(�
�����S�Z�Z��0����S�Z�Z�(�
�����S�Z�Z��0��4�4�s�B-�-B6c����
�ddl}ddl}ddlm}	ddl}�j
dd��
|jj|�djd�d}tjjt|�}��
�fd�}tjj|�r||�}	|	�|	S||�td	�t rt#d
|zt%���|j&j)�}
|r|
j*j-d�|
j/|t0�
�}	|r0|	j2j5d�dk(r|j7|	��}		t/|d�5}|	j9�}|r$|j;|�|	j9�}|r�$ddd�|	j=�||�}	|	�|	St?d|z��#t
$rd}Y���wxYw#1swY�ExYw#|	j=�wxYw)Nrr�)�unlink�checkr��/���c���t|g���i���}��|S�|�r|jd�|S|j�yrB)�open�seek�close)rxrvrfr�r
s  ���r[�check_valid_filez*open_urlresource.<locals>.check_valid_file�sA�����!�d�!�b�!���=��H�
�1�X�
�F�F�1�I��H�	���	rZr�z	fetching %s ...��file)zAccept-EncodingrI��timeoutzContent-EncodingrI)�fileobj�wbzinvalid resource %r) �urllib.request�urllib.parse�	os_helperr�rIrD�pop�parse�urlparser�r�r�r��
TEST_DATA_DIRrtrrr�r
�request�build_opener�
addheaders�appendr�rL�headers�get�GzipFile�read�writer�r	)�urlrfr
�urllibr�rIrurxr�rv�opener�out�sr�s ``          @r[r9r9�s����'�!���
�F�F�7�D�!�E��|�|�$�$�S�)�!�,�2�2�3�7��;�H�	�����m�X�	.�B��
�w�w�~�~�b���R� ���=��H��r�
�
�Z���
�!�C�'�.A�.C�D�
�^�^�
(�
(�
*�F����� � �!<�=����C�!1��2�A���	�	�
�
�0�1�V�;��M�M�!�M�$���
�"�d�^�	�s�����A���	�	�!���F�F�H���	�	
���	����A��}���
�*�R�/�
0�0��_������H	�	��	
���	�s5�G�!G4�-6G(�$G4�G%�$G%�(G1�-G4�4Hc#��K�ddl}tt|�}tt||j	��	tt|���tt||�y#tt||�wxYw�w)z�Return a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.rN)�ior�r��setattr�StringIO)�stream_namer��orig_stdouts   r[�captured_outputr��sS������#�{�+�K��C��b�k�k�m�,�/��c�;�'�'���[�+�.����[�+�.�s�4A1�A�	A1�A.�.A1c��td�S)z�Capture the output of sys.stdout:

       with captured_stdout() as stdout:
           print("hello")
       self.assertEqual(stdout.getvalue(), "hello\n")
    r��r�rYrZr[rr�����8�$�$rZc��td�S)z�Capture the output of sys.stderr:

       with captured_stderr() as stderr:
           print("hello", file=sys.stderr)
       self.assertEqual(stderr.getvalue(), "hello\n")
    �stderrr�rYrZr[rr�r�rZc��td�S)a	Capture the input to sys.stdin:

       with captured_stdin() as stdin:
           stdin.write('hello\n')
           stdin.seek(0)
           # call test code that consumes from sys.stdin
           captured = input()
       self.assertEqual(captured, "hello")
    �stdinr�rYrZr[rr�s���7�#�#rZc�l�ddl}|j�|j�|j�y)a�Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    rN)�gc�collect)r�s r[�
gc_collectr��s"����J�J�L��J�J�L��J�J�LrZc#�K�ddl}|j�}|j�	d��|r|j�yy#|r|j�wwxYw�wrB)r��	isenabled�disable�enable)r��have_gcs  r[�
disable_gcr�sG����
��l�l�n�G��J�J�L��
���I�I�K���7��I�I�K��s�%A�A�A�A�Ac��tjd�xsd}d}|j�D]}|jd�s�|}�|dvS)z,Find if Python was built with optimizations.�	PY_CFLAGSr%z-O)r%z-O0z-Og)r'r(r�r�)r)�	final_opt�opts   r[�python_is_optimizedr�sP��
�
%�
%�k�
2�
8�b�F��I��|�|�~����>�>�$���I���.�.�.rZc���tjd�xsd�gd�}tjd�}|r|j|�t�fd�|D��S)N�PY_CFLAGS_NODISTr%)z
-fprofile-usez-fprofile-instr-usez	-prof-use�PGO_PROF_USE_FLAGc3�&�K�|]}|�v���
y�wrarY)�.0r7�
cflags_nodists  �r[�	<genexpr>z#check_cflags_pgo.<locals>.<genexpr>)s�����A�6�v��&�A�s�)r'r(r��any)�pgo_optionsr�r�s  @r[�check_cflags_pgor�sY����,�,�-?�@�F�B�M��K�"�0�0�1D�E������,�-��A�[�A�A�ArZ�nP�0n�
getobjects�2P�0P�nc�H�ddl}|jt|ztz�SrB)�struct�calcsize�_header�_align��fmtr�s  r[�calcobjsizer�3s����?�?�7�S�=�6�1�2�2rZc�H�ddl}|jt|ztz�SrB)r�r��_vheaderr�r�s  r[�calcvobjsizer�7s����?�?�8�c�>�F�2�3�3rZi@ic��	ddl}t	j
|�}t
|�tk(r|jtzs.t
|�tk7r+t
|�jtzr||jz
}dt
|�||fz}|j|||�y#t$rtjd��wxYw)NrrOz&wrong size for %s: got %d, expected %d)rQrDrxr�r��	getsizeofr��	__flags__�_TPFLAGS_HEAPTYPE�_TPFLAGS_HAVE_GC�SIZEOF_PYGC_HEADr�)�test�o�sizerQr�rbs      r[�check_sizeofr�?s���>� ��]�]�1�
�F�	
�a��D��q�{�{�->�>�
�q�'�T�/��Q�� 1� 1�4D� D��!�2�2�2��
2��A�w���%�&�C����V�T�3�'���>���� <�=�=�>�s�B"�"Cc'�2K�	ddl}t||�}|j|�}|D]}	|j||�n		d��|r|r|j|�yyy#Y�<xYw#t$r�dx}}Y�6xYw#|r|r|j|�wwwxYw�wrB)�localer��	setlocaler�)�catstr�localesr��category�orig_locale�locs      r[r;r;Qs��������6�6�*���&�&�x�0���	�C�
�� � ��3�/��	�4�
��k����X�{�3�"�6��

�����
�$�#�#�����k����X�{�3�"�6�sI�B�!A&�B�A�B�A:�B�A#�!B�&A7�5B�:B�Bc����fd�}|S)Nc�Z�����fd�}�j|_�j|_|S)Nc���	tj}dt
jvrt
jd}nd}�t
jd<|�	�|i|��|�t
jd=n|t
jd<tj�S#t$rtjd��wxYw#|�t
jd=n|t
jd<tj�wxYw)Nztzset required�TZ)�time�tzsetr�rxr�r��environ)rf�kwdsr	�orig_tzr��tzs    ��r[�innerz-run_with_tz.<locals>.decorator.<locals>.innerqs����
:��
�
���r�z�z�!��*�*�T�*����!�B�J�J�t���G�
��T�*�T�*��?��
�
�4�(�'.�B�J�J�t�$��
�
���#"�
:��'�'�(8�9�9�
:���?��
�
�4�(�'.�B�J�J�t�$��
�
��s�B�B;�B8�;=C8)rUrX)r�rr
s` �r[rzrun_with_tz.<locals>.decoratorps%���	�,���������
��rZrY)r
rs` r[rDrDos����4�rZi�r���limitc�F�dttdtzd�}tjd|tjtj
z�}|�t
d|����tt|jd��||jd�j�z�S)Nr)�k�m�g�tz(\d+(?:\.\d+)?) (K|M|G|T)b?$zInvalid memory limit: r�r�)�_1M�_1G�re�match�
IGNORECASE�VERBOSEr�r��float�groupr)r�sizesrs   r[�_parse_memlimitr �s���
�
�
�
�#�X�	
�E�	���0�%�������+�	-�A��y��1�%��;�<�<��u�Q�W�W�Q�Z� �5������)9�)9�);�#<�<�=�=rZc�p�t|�}|tdz
krtd��|at	|t
�}|ay)Nr�z+Memory limit {limit!r} too low to be useful)r �_2Gr��real_max_memuse�min�MAX_Py_ssize_tr)r�memlimits  r[rArA�s<���u�%�H��#��'���F�G�G��O��8�^�,�H��JrZc�"�eZdZdZd�Zd�Zd�Zy)�_MemoryWatchdogz`An object which periodically watches the process' memory consumption
    and prints it out.
    c�d�djtj���|_d|_y)Nz/proc/{pid}/statm)�pidF)r�r��getpid�procfile�startedris r[rdz_MemoryWatchdog.__init__�s$��+�2�2�r�y�y�{�2�C��
���rZc��ddl}	t|jd�}ddl
}|5td�}|jtj|g||j��|_ddd�d|_y#t$rN}|jdj|�t�tjj�Yd}~yd}~wwxYw#1swYd|_yxYw)Nr�rz!/proc not available for stats: {}zmemory_watchdog.py)r�r�T)rr�r,r�rr�rr�r��flush�
subprocessr=�Popen�
executable�DEVNULL�mem_watchdogr-)rerrvr�r1�watchdog_scripts      r[�startz_MemoryWatchdog.start�s����	��T�]�]�C�(�A�	�
�	L�&�';�<�O� *� 0� 0�#�.�.�/�1R�78�8B�8J�8J�!1�!L�D��	L�
�����	��H�M�M�=�D�D�Q�G�(�
*��J�J������		��	L�
���s#�A1�?C�1	C�:AC�C�Cc��|jr5|jj�|jj�yyra)r-r5�	terminate�waitris r[�stopz_MemoryWatchdog.stop�s2���<�<����'�'�)����"�"�$�rZN)rUrVrWrXrdr7r;rYrZr[r(r(�s�����$%rZr(c��������fd�}|S)atDecorator for bigmem tests.

    'size' is a requested size for the test (in arbitrary, test-interpreted
    units.) 'memuse' is the number of bytes per unit for the test, or a good
    estimate of it. For example, a test that needs two byte buffers, of 4 GiB
    each, could be decorated with @bigmemtest(size=_4G, memuse=2).

    The 'size' argument is normally passed to the decorated test method as an
    extra argument. If 'dry_run' is true, the value passed to the test method
    may be less than the requested value. If 'dry_run' is false, it means the
    test doesn't support dummy runs when -M is not specified.
    c�6�������fd����_��_�S)Nc����j}�j}tsd}n|}ts�s*t||zkrtjd||zdzz��trLt
rFt
�t
dj||zdz���t�}|j�nd}	�||�|r|j�SS#|r|j�wwxYw)Ni�'not enough memory: %.1fG minimum needed�@z* ... expected peak memory use: {peak:.1f}G)�peak)r��memuser#rxr�rr�r�r(r7r;)rer�rB�maxsize�watchdog�dry_runrvrs     ���r[rz.bigmemtest.<locals>.decorator.<locals>.wrapper�s�����<�<�D��^�^�F�"����� ��#�g��&6�6��'�'�=��f�}�	�2�4�5�5��7����B��v�4�&�=�I�#>�v�?�A�*�,����� ���
$���w�'���M�M�O���8��M�M�O��s�,C�C)r�rB)rvrrErBr�s`@���r[rzbigmemtest.<locals>.decorator�s���	$�:�������rZrY)r�rBrErs``` r[rr�s��� �B�rZc����fd�}|S)z0Decorator for tests that fill the address space.c���ttkrFtdk\rtdk\rtjd��tjdtdzz���|�S)Nl����lz-not enough memory: try a 32-bit build insteadr?r@)rr%rxr�)rervs �r[rz!bigaddrspacetest.<locals>.wrappersb�����&���*�z�U�/B��'�'�C�E�E��'�'�=�%��3�5�6�6��T�7�NrZrY)rvrs` r[rrs���
��NrZc��|SrarY)r�s r[�_idrIs���JrZc���|dk(r-t�s#tjtj�St	|�rt
Stjdj
|��S)Nr�zresource {0!r} is not enabled)r�rxrr�rrIr�r�s r[�requires_resourcerKsN���5��!2�!4��}�}�.�5�5�6�6��8�$��
��}�}�<�C�C�H�M�N�NrZc�&�td��|�S)z9
    Decorator for tests only applicable on CPython.
    T)�cpython)�impl_detail�r�s r[rr s��%�;�t�$�T�*�*rZc���tdi|��rtS|�Nt|�\}}|rd}nd}t|j	��}|jdj
|��}tj|�S)Nz*implementation detail not available on {0}z%implementation detail specific to {0}z or rY)	r5rI�
_parse_guardsrz�keysr�r�rxr)rb�guards�
guardnames�defaults    r[rNrN&sj���"�6�"��
�
�{�+�F�3��
�G��>�C�9�C��J�O�O�-�.�
��j�j����Z�0�1���=�=���rZc��|sddidfSt|j��d}t|j��|gt|�zk(sJ�||fS)NrMTFr)�list�valuesr�)rS�is_trues  r[rQrQ3s[����D�!�5�)�)��6�=�=�?�#�A�&�G���
�
�� �W�I��F��$;�;�;�;���K� � rZc�r�t|�\}}|jtjj|�S)a5This function returns True or False depending on the host platform.
       Examples:
          if check_impl_detail():               # only on CPython (default)
          if check_impl_detail(jython=True):    # only on Jython
          if check_impl_detail(cpython=False):  # everywhere except on CPython
    )rQr�r��implementationr�)rSrUs  r[r5r5=s/��$�F�+�O�F�G��:�:�c�(�(�-�-�w�7�7rZc�f��ttd�s�Stj���fd��}|S)zEDecorator to temporarily turn off tracing for the duration of a test.�gettracec����tj�}	tjd��|i|��tj|�S#tj|�wxYwra)r�r]�settrace)rfr<�original_tracer�s   �r[rzno_tracing.<locals>.wrapperMsE��� �\�\�^�N�
-����T�"��T�,�V�,����^�,�����^�,�s�A	�	A )r�r�rr)r�rs` r[�
no_tracingraHs4����3�
�#���	����	�	-�
�	-��rZc�*�tt|��S)aDecorator for tests which involve reference counting.

    To start, the decorator does not run the test if is not run by CPython.
    After that, any trace function is unset during the test to prevent
    unexpected refcounts caused by the trace function.

    )rarrOs r[�
refcount_testrcXs���l�4�(�)�)rZc��	ddl}tj|j
d�|�S#t$rtjd�|�cYSwxYw)Nrzneeds _testcapi modulezneeds Limited API support)rZrDrxrrE�LIMITED_API_AVAILABLE)r�rZs  r[r.r.csa��=��F�8����'�'�)D�F�FJ�L�L���=�6�x�}�}�5�6�t�<�<�=�s�,�$A�Ac�V�tjtjd�|�S)Nzrequires specialization)rxrE�opcode�ENABLE_SPECIALIZATIONrOs r[r/r/ks1��A�8����$�$�&?�A�AE�G�GrZc��y)z,Just used to check if docstrings are enabledNrYrYrZr[�_check_docstringsrjvs�rZ�WITH_DOC_STRINGSztest requires docstringsc��tj�tjj�tj�tjj�yyra)r�r�r0r�rYrZr[�flush_std_streamsrm�s;��
�z�z���
�
����
�z�z���
�
����rZc��t�tj}|j�D]}t	d|��|���|j�y)NzWarning -- r�)rm�
print_warning�orig_stderr�
splitlinesr�r0)rb�stream�lines   r[roro�sC����
�
&�
&�F���� �1��
��D�6�"��0�1�
�L�L�NrZc���ttd�rttd�sytsy		tjdtj�\}}|dk(ryt
d|���da�?#t
$rYywxYw)z�Use this function at the end of test_main() whenever sub-processes
    are started.  This will help ensure that no extra children (zombies)
    stick around to hog resources and create problems when looking
    for refleaks.
    �waitpid�WNOHANGNTr�rz%reap_children() reaped child process )r�r�r"rurvr�ro�environment_altered)r*�statuss  r[r:r:�s}��
�B�	�"�w�r�9�'=��
#���	��*�*�R����4�K�C���!�8���=�c�U�C�D�"�����	��	�s�'A)�)	A5�4A5c#�2K�t||�r,t||�}t|||�	|��t|||�yt|||�	d��t||�r
t||�yy#t|||�wxYw#t||�r
t||�wwxYw�w)a�Temporary swap out an attribute with a new object.

    Usage:
        with swap_attr(obj, "attr", 5):
            ...

        This will set obj.attr to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `attr` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    N)r�r�r��delattr)r��attr�new_val�real_vals    r[r?r?�s����� �s�D���3��%����T�7�#�	)��N��C��x�(���T�7�#�	#���s�D�!���T�"�"��

�C��x�(���s�D�!���T�"�"�s3�&B�A'�B�	A9�
B�'A6�6B�9B�Bc#�K�||vr||}|||<	|��|||<y|||<	d��||vr||=yy#|||<wxYw#||vr||=wwxYw�w)a�Temporary swap out an item with a new object.

    Usage:
        with swap_item(obj, "item", 5):
            ...

        This will set obj["item"] to 5 for the duration of the with: block,
        restoring the old value at the end of the block. If `item` doesn't
        exist on `obj`, it will be created and then deleted at the end of the
        block.

        The old value (or None if it doesn't exist) will be assigned to the
        target of the "as" clause, if there is one.
    NrY)r��itemr|r}s    r[r<r<�sz���� �s�{��t�9����D�	�	!��N� �C��I���D�	�	���s�{���I���
!�C��I���s�{���I��s+�A�/�A�9�	A�6�A�
A�Ac�*�ddl}|j�S)znReturn a list of command-line arguments reproducing the current
    settings in sys.flags and sys.warnoptions.rN)r1�_args_from_interpreter_flags�r1s r[�args_from_interpreter_flagsr��s����2�2�4�4rZc�*�ddl}|j�S)zgReturn a list of command-line arguments reproducing the current
    optimization settings in sys.flags.rN)r1�"_optim_args_from_interpreter_flagsr�s r[�!optim_args_from_interpreter_flagsr�s����8�8�:�:rZc��eZdZdZd�Zd�Zy)r@)rb�messagec�t�d}|D]0}||}|j|�}|j|||�r�-d}|S|S)a.
        Try to match a single dict with the supplied arguments.

        Keys whose values are strings and which are in self._partial_matches
        will be checked for partial (i.e. substring) matches. You can extend
        this scheme to (for example) do regular expression matching, etc.
        TF)r��match_value)re�dr<r�r�v�dvs       r[�matcheszMatcher.matchessT�����	�A��q�	�A����q��B��#�#�A�r�1�-�����
�
	��
rZc��t|�t|�k7rd}|St|�tus||jvr||k(}|S|j|�dk\}|S)zT
        Try to match a single stored value (dv) with a supplied value (v).
        Fr)r�r��_partial_matches�find)rerr�r�r�s     r[r�zMatcher.match_value!sc����7�d�2�h���F�
�
�	�"�X�S�
 �A�T�-B�-B�$B��2�g�F��
��W�W�Q�Z�1�_�F��
rZN)rUrVrWr�r�r�rYrZr[r@r@s��)���"
rZr@c���ddl}t�Ltjdk(r7|j	�dk(r$tj�jdk(rdandatrtjd�|�S|S)	a-
    Skip decorator for tests that use buggy strptime/strftime

    If the UCRT bugs are present time.localtime().tm_zone will be
    an empty string, otherwise we assume the UCRT bugs are fixed

    See bpo-37552 [Windows] strptime/strftime return invalid
    results with UCRT version 17763.615
    rNr\�cp65001r%TFz!buggy MSVC UCRT strptime/strftime)
r��_buggy_ucrtr�r��getencodingr�	localtime�tm_zonerxr)r�r�s  r[r*r*/si������<�<�7�"��"�"�$�	�1���� �(�(�B�.��K��K�GR�=�8�=�=�<�=�d�C�\�X\�\rZc�n�eZdZdZdd�Zejdk(rd�Znd�Zd�Zd�Z	d	�Z
d
d�d�Zd
d�d
�Zy)�
PythonSymlinkz3Creates a symlink for the current Python executableNc��ddlm}|xstjj	|�|_g|_tjjtj�|_
g|_d|_|j�y)Nr�)�TESTFN)r�r�r�r��abspath�link�_linked�realpathr�r3�real�
_also_link�_env�_platform_specific)rer�r�s   r[rdzPythonSymlink.__init__FsY��%��3�B�G�G�O�O�F�3��	�����G�G�$�$�S�^�^�4��	������	����!rZr\c
���ddl}ddl}tjj	|j
�r?tjj
|j
�s|jd�|_|jtj�}tjj|�}tjj|j�}|jj|tjj|tjj|��f�|jtjj|j!|�d��D]Z}|jj|tjj|tjj|��f��\tj"D�cic]&}|j%�tj&|���(c}|_tjj|j
�|j(d<t+j,�rt.|j(d<yycc}w)Nrzvcruntime*.dll�
PYTHONHOME�
PYTHONPATH)�glob�_winapir�r��lexistsr�rt�GetModuleFileNamer��	dllhandle�dirnamer�r�r�r��basename�escaper
�upper�getenvr�r'�is_python_buildr)rer�r�r��src_dir�dest_dir�runtimers        r[r�z PythonSymlink._platform_specificSs������w�w���t�y�y�)�"�'�'�.�.����2K�$�5�5�a�8��	��+�+�C�M�M�:�C��g�g�o�o�c�*�G��w�w���t�y�y�1�H��O�O�"�"�������X�r�w�w�'7�'7��'<�=�$�
� �9�9�R�W�W�\�\�$�+�+�g�2F�HX�%Y�Z�
�����&�&���G�G�L�L��2�7�7�+;�+;�G�+D�E�(��
�;=�*�*�E�Q�����B�I�I�a�L�0�E�D�I�&(�g�g�o�o�d�i�i�&@�D�I�I�l�#��(�(�*�*4��	�	�,�'�+��Fs�+I/c��yrarYris r[r�z PythonSymlink._platform_specificn���rZc�.�tj|j|j�|jj|j�|jD]6\}}tj||�|jj|��8|Sra)r��symlinkr�r�r�r�r�)rer�r�s   r[�	__enter__zPythonSymlink.__enter__qsl��
�
�
�4�9�9�d�i�i�(������D�I�I�&��/�/�	&�J�D�$��J�J�t�T�"��L�L����%�	&��rZc��|jD]}	tj|��y#t$r+}trtdj
||��Yd}~�Kd}~wwxYw)Nzfailed to clean up {}: {})r�r��remove�IOErrorrr�r�)re�exc_type�	exc_value�exc_tbr��exs      r[�__exit__zPythonSymlink.__exit__ysV���L�L�	H�D�
H��	�	�$��	H���
H���5�<�<�T�2�F�G���
H�s�)�	A�!A�Ac�x�ddl}|g|�}|j||j|j|��}|j�}|j|k7rht
r>t
t|d��t
t|d�tj��tdj|j���|S)Nr)r�r�r6r�r�z'unexpected return code: {0} (0x{0:08X}))r1r2�PIPE�communicate�
returncoderr��reprr�r��RuntimeErrorr�)	re�pythonrfr6r�r1�cmd�pr/s	         r[�_callzPythonSymlink._call�s�����o��o�����S����$.�O�O��
�
>��
�M�M�O���<�<�:�%���d�1�Q�4�j�!��d�1�Q�4�j�s�z�z�2��9�@�@����N�P�
P��rZr)r�c�>�|j|j|d|�Sra)r�r��rer�rfs   r[�	call_realzPythonSymlink.call_real�s���z�z�$�)�)�T�4��<�<rZc�R�|j|j||j|�Sra)r�r�r�r�s   r[�	call_linkzPythonSymlink.call_link�s���z�z�$�)�)�T�4�9�9�j�A�ArZra)
rUrVrWrXrdr�r�r�r�r�r�r�r�rYrZr[r�r�DsG��=�
"��|�|�w��	5�6	��H��+,�=�+,�BrZr�c�b�txst}d}|r|Stj|�|�S)z;Skip decorator for tests not run in (non-extended) PGO taskz#Not run for (non-extended) PGO task)rE�PGO_EXTENDEDrxr)r��okrbs   r[�skip_if_pgo_taskr��s1��
��	 �L�B�
/�C��4�3�-�8�=�=��-�d�3�3rZrY)�ignorec��tt|��tt|��z
}|r|t|�z}td�|D��}|S)aReturns the set of items in ref_api not in other_api, except for a
    defined list of items to be ignored in this check.

    By default this skips private attributes beginning with '_' but
    includes all magic methods, i.e. those starting and ending in '__'.
    c3�dK�|](}|jd�r|jd�r|���*y�w)ro�__N)r��endswith)r�rs  r[r�z&detect_api_mismatch.<locals>.<genexpr>�s0����F�a� �|�|�C�0�A�J�J�t�4D��F�s�.0)�set�dir)�ref_api�	other_apir��
missing_itemss    r[r(r(�sP����G��%��C�	�N�(;�;�M�
���V��$�
��F�=�F�F�M��rZc��|�|jf}nt|t�r|f}t|�}t	|�D]l}|jd�s||vr�t
||�}t
|dd�|vs(t|d�r�At|tj�r�\|j|��n|j|j|�y)a)Assert that the __all__ variable of 'module' contains all public names.

    The module's public names (its API) are detected automatically based on
    whether they match the public name convention and were defined in
    'module'.

    The 'name_of_module' argument can specify (as a string or tuple thereof)
    what module(s) an API could be defined in in order to be detected as a
    public API. One case for this is when 'module' imports part of its public
    API from other modules, possibly a C backend (like 'csv' and its '_csv').

    The 'extra' argument can be a set of names that wouldn't otherwise be
    automatically detected as "public", like objects without a proper
    '__module__' attribute. If provided, it will be added to the
    automatically detected ones.

    The 'not_exported' argument can be a set of names that must not be treated
    as part of the public API even though their names indicate otherwise.

    Usage:
        import bar
        import foo
        import unittest
        from test import support

        class MiscTestCase(unittest.TestCase):
            def test__all__(self):
                support.check__all__(self, foo)

        class OtherTestCase(unittest.TestCase):
            def test__all__(self):
                extra = {'BAR_CONST', 'FOO_CONST'}
                not_exported = {'baz'}  # Undocumented name.
                # bar imports part of its API from _bar.
                support.check__all__(self, bar, ('bar', '_bar'),
                                     extra=extra, not_exported=not_exported)

    NrorV)
rU�
isinstancer�r�r�r�r�r��types�
ModuleType�add�assertCountEqual�__all__)�	test_casere�name_of_module�extra�not_exported�expectedr�r�s        r[r)r)�s���R�� �/�/�,��	�N�C�	(�(�+���5�z�H��F�����?�?�3��4�<�#7���f�d�#���C��t�,��>��S�,�/���U�%5�%5�6��L�L�������v�~�~�x�8rZc��	ddl}|j|j|jz|j
z|jz�t|d�rv|j|j|jfD]O}|r9|j||j�|j||j��>|j|d��Qyy#t$rYywxYw)Nr�CrtSetReportMode)�msvcrtrD�SetErrorMode�SEM_FAILCRITICALERRORS�SEM_NOALIGNMENTFAULTEXCEPT�SEM_NOGPFAULTERRORBOX�SEM_NOOPENFILEERRORBOXr��CRT_WARN�	CRT_ERROR�
CRT_ASSERTr��CRTDBG_MODE_FILE�CrtSetReportFile�CRTDBG_FILE_STDERR)rr�rs   r[�suppress_msvcrt_assertsr��s���������5�5� �;�;�<� �6�6�7�!�7�7�8�9��v�)�*��/�/�6�#3�#3�V�5F�5F�G�	.�A���'�'��6�+B�+B�C��'�'��6�+D�+D�E��'�'��1�-�	.�+������s�C�	C�Cc�$�eZdZdZdZdZd�Zd�Zy)rBz�Try to prevent a crash report from popping up.

    On Windows, don't display the Windows Error Reporting dialog.  On UNIX,
    disable the creation of coredump file.
    Nc�~�tjjd�r�	ddl}|j�|_|j|j|jz�t|d�rxi|_
|j|j|jfD]K}|j||j�}|j!||j"�}||f|j|<�M|S	ddl}||_|j$�t	|j$j'|j$j(�|_|j$j+|j$j(d|jdf�tjdk(roddl}gd�}|j3||j4|j4��}|5|j7�d}	ddd�	j9�d	k(rt;d
dd�
�|S#t$rYywxYw#t$rd|_Y��&wxYw#t,t.f$rY��wxYw#1swY�gxYw)z�On Windows, disable Windows Error Reporting dialogs using
        SetErrorMode() and CrtSetReportMode().

        On UNIX, try to save the previous core file size limit, then set
        soft limit to 0.
        r�rNr�r�r�)z/usr/bin/defaultsr�zcom.apple.CrashReporter�
DialogType)r�r�s	developerz:this test triggers the Crash Reporter, that is intentionalr%T)�endr0)r�r�r�r�rD�GetErrorMode�	old_valuer�r�r��	old_modesr�r�r�r�r�r�r�r��	getrlimit�RLIMIT_CORE�	setrlimitr�r�r1r2r�r��stripr�)
rer��report_type�old_mode�old_filer�r1r��procr�s
          r[r�zSuppressCrashReport.__enter__s)���<�<�"�"�5�)�
��$�0�0�2�D�N��������1M�1M� M�N��v�1�2�!#���$*�O�O�$*�$4�$4�$*�$5�$5�$7�E�K� &�6�6�{�"�3�3� 5�H�%�6�6�{�"�5�5� 7�H�2:�H�2D�D�N�N�;�/�E�T��A
%�� (��
��}�}�(��%)�]�]�%<�%<�T�]�]�=V�=V�%W�D�N��M�M�+�+�D�M�M�,E�,E�-.����q�0A�,B�D�
�|�|�x�'�!�@��!�'�'��/9���/9���(�@���3�!�-�-�/��2�F�3��<�<�>�\�1��0�57�t�E����k�
��
��0�
%� $��
�
%��#�G�,����� 3�3�sB�G8�)H�A3H�9H3�8	H�H�H�H�H0�/H0�3H<c��|j�ytjjd�rvddl}|j|j�|jrJ|jj�D],\}\}}|j||�|j||��.yy|j�<	|jj|jj|j�yy#ttf$rYywxYw)zARestore Windows ErrorMode or core file behavior to initial value.Nr�r)r�r�r�r�r�r�rr{r�r�r�rrr�r�)re�
ignore_excr�rrrs      r[r�zSuppressCrashReport.__exit__Gs����>�>�!���<�<�"�"�5�)��������/��~�~�9=���9M�9M�9O�C�5�K�!5�(�H��+�+�K��B��+�+�K��B�C��
�}�}�(���M�M�+�+�D�M�M�,E�,E�t�~�~�V�)��#�G�,����s�0:C,�,C>�=C>)rUrVrWrXr�rr�r�rYrZr[rBrB�s���
�I��I�@�DrZrBc�������t���d�	�j��d�����fd�}|j	|�t��|�y#ttf$rt��d��Y�EwxYw)z�Override 'object_to_patch'.'attr_name' with 'new_value'.

    Also, add a cleanup procedure to 'test_instance' to restore
    'object_to_patch' value for 'attr_name'.
    The 'attr_name' should be a valid attribute for 'object_to_patch'.

    FTNc�>���rt����yt���yra)r�rz)�
attr_is_local�	attr_name�object_to_patchr�s����r[�cleanupzpatch.<locals>.cleanuprs�����O�Y�	�:��O�Y�/rZ)r��__dict__r�r�
addCleanupr�)�
test_instancerr�	new_valuerr
r�s ``  @@r[�patchr\sy����O�Y�'��M��#�,�,�Y�7�	��
�0����W�%��O�Y�	�2��
�H�%�>��O�Y��=�	�>�s�A�A+�*A+c#�>K�	|dd}d��||ddy#|ddwxYw�w)z-Like unittest.mock.patch.dict, but for lists.NrY)�orig�saveds  r[�
patch_listr~s)������Q���
���Q���%��Q��s��	���c�@�t�ddl}|j|�S)�i
    Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc
    module is enabled.
    rN)�_check_tracemallocrZ�run_in_subinterp)r�rZs  r[rr�s��
����%�%�d�+�+rZ)�own_gilc�t�t�ddl}|�d|vs	J||f��|rdnd|d<|j|fi|��S)rrN�gilr�r�)rrZ�run_in_subinterp_with_config)r�rrSrZs    r[r!r!�sP��
������F�"�5�W�f�$5�5�"�$��!��u�
�1�9�1�1�$�A�&�A�ArZc�v�	ddl}|j�rtjd��y#t$rYywxYw)NrzUrun_in_subinterp() cannot be used if tracemalloc module is tracing memory allocations)�tracemalloc�
is_tracingrxr�rD)r#s r[rr�sI��;���!�!�#��#�#�%:�;�
;�$���
��
�s�,�	8�8c����G��fd�d|�}d�|||���|jtt��t�|j	��y)Nc���eZdZ��fd�Zy)�%check_free_after_iterating.<locals>.Ac�@��d�	t��y#t$rYywxYw�NT)�next�
StopIteration)re�done�its ��r[�__del__z-check_free_after_iterating.<locals>.A.__del__�s&����D�
��R��� �
��
�s��	�N)rUrVrWr.)r,r-s��r[�Ar'�s���	rZr/F)�assertRaisesr+r*r��
assertTrue)r��iter�clsrfr/r,r-s     @@r[�check_free_after_iteratingr4�sF����C���D�	
�a��h��B����m�T�2�.��L��O�O�D�rZc�r�ddlm}m}m}ddlm}|j
�}|j|�|jdk(r	|j�|jD]A}|r||vr�
t||�}|r|�
Jd|z��|s�'|j|d���<|dcSy#|j$rYywxYw)a<Check if the compiler components used to build the interpreter exist.

    Check for the existence of the compiler executables whose names are listed
    in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
    and return the first missing executable or None when none is found
    missing.

    r)�	ccompilerr'�spawn)rp�msvcNz%the '%s' executable is not configured)�setuptools._distutilsr6r'r7�
setuptoolsrp�new_compiler�customize_compiler�
compiler_type�
initialize�
PlatformError�executablesr��find_executable)�	cmd_namesr6r'r7rp�compilerr�r�s        r[rFrF�s���B�A�!��%�%�'�H� �I� � ��*�����'�	����!��$�$�
����Y�.���h��%����?�
C�;�d�B�
C�?���� � ��Q��(�0��q�6�M�
���#�#�	��	�s�B$�$B6�5B6c��d}tr;||kr6t�(ddl}|jddg�j	�dk(atr|}tj|�S)Ng�h㈵��>r�getpropzro.kernel.qemu�1)r2�_is_android_emulatorr1�check_outputrr�r7)�interval�minimum_intervalr1s   r[r7r7�s`�����h�!1�1��'��$.�$;�$;� )�+;�<�%>�>C�e�g��%N� ��'�H�� � ��*�*rZc��	tjd�}|S#ttf$r3	tjd�}Y|S#ttf$rd}YY|SwxYwwxYw)zGet size of a page in bytes.�SC_PAGESIZE�SC_PAGE_SIZEi)r��sysconfr�r�)�	page_sizes r[r8r8�so����J�J�}�-�	����
��'��	��
�
�>�2�I�����N�+�	��I���	���s&��A�A�A�A�A�Ac#�K�ddl}tjj�}|j	�}	|j�d��|r|j
|d��yy#|r|j
|d��wwxYw�w)NrT)r��all_threads)�faulthandlerr��
__stderr__�fileno�
is_enabledr�r�)rR�fdrUs   r[�disable_faulthandlerrW�su�����


���	�	�	 �B��(�(�*�J�;�����
�����R�T��:���:����R�T��:��s�3A<�A!�
A<�!A9�9A<c�"�eZdZdZd�Zd�Zd�Zy)�SaveSignalsz�
    Save and restore signal handlers.

    This class is only able to save/restore signal handlers registered
    by the Python signal module: see bpo-13285 for "external" signal
    handlers.
    c���ddl}||_|j�|_dD]*}	t||�}|jj|��,i|_y#t$rY�@wxYw)Nr)�SIGKILL�SIGSTOP)�signal�
valid_signals�signalsr�r�r��handlers)rer]�signame�signums    r[rdzSaveSignals.__init__sm�������+�+�-���-�	(�G�
� ���1��
�L�L����'�	(���
��"�
��
�s�A�	A$�#A$c��|jD]/}|jj|�}|��!||j|<�1yra)r_r]�	getsignalr`�rerb�handlers   r[�savezSaveSignals.save%sA���l�l�		,�F��k�k�+�+�F�3�G����$+�D�M�M�&�!�		,rZc��|jj�D]!\}}|jj||��#yra)r`r{r]res   r[�restorezSaveSignals.restore1s6��#�}�}�2�2�4�	0�O�F�G��K�K���v�w�/�	0rZN)rUrVrWrXrdrgrirYrZr[rYrYs����
,�0rZrYc�"�ddl}|jSrB)rZ�
WITH_PYMALLOC)rZs r[�
with_pymallocrl6s����"�"�"rZc��eZdZdZd�Zd�Zy)�
_ALWAYS_EQz+
    Object that is equal to anything.
    c��yr)rY�re�others  r[�__eq__z_ALWAYS_EQ.__eq__?���rZc��y�NFrYrps  r[�__ne__z_ALWAYS_EQ.__ne__A���rZN)rUrVrWrXrrrvrYrZr[rnrn;s����rZrnc�"�eZdZdZd�Zd�Zd�Zy)�	_NEVER_EQz/
    Object that is not equal to anything.
    c��yrurYrps  r[rrz_NEVER_EQ.__eq__JrwrZc��yr)rYrps  r[rvz_NEVER_EQ.__ne__LrsrZc��y)Nr�rYris r[�__hash__z_NEVER_EQ.__hash__Ns��rZN)rUrVrWrXrrrvr}rYrZr[ryryFs�����rZryc��eZdZdZd�Zd�Zy)�_LARGESTz?
    Object that is greater than anything (except itself).
    c�"�t|t�Sra)r�rrps  r[rrz_LARGEST.__eq__Xs���%��*�*rZc��yrurYrps  r[�__lt__z_LARGEST.__lt__ZrwrZN)rUrVrWrXrrr�rYrZr[rrSs���+�rZrc��eZdZdZd�Zd�Zy)�	_SMALLESTz<
    Object that is less than anything (except itself).
    c�"�t|t�Sra)r�r�rps  r[rrz_SMALLEST.__eq__ds���%��+�+rZc��yrurYrps  r[�__gt__z_SMALLEST.__gt__frwrZN)rUrVrWrXrrr�rYrZr[r�r�_s���,�rZr�c�6�ddl}|jjS)zDReturn the global event loop policy if one is set, else return None.rN)�asyncio.events�events�_event_loop_policy)�asyncios r[�maybe_get_event_loop_policyr�ks����>�>�,�,�,rZ)� �@c�~�||}}ddl}|j�5}|j�dz}t|d�|_|j|�}|dz
|z|z}||z}	||	z
}
||
z
}||dz
z|dz
|z|zz|	d|	z
zz}t
|�t
|j��fcddd�S#1swYyxYw)Nrr��r�)�decimal�localcontext�
bit_length�max�prec�Decimalr�sqrt)
�nbins�nballsr�rr��ctx�bitsrw�p1empty�	meanempty�occupied�
collisions�vars
             r[�collision_statsr�xs����&�q�A�$�	�	�	�	�4�3��|�|�~��!���t�R�=���
�_�_�Q�
����F�b�=�Q�&����K�	��y�=����\�
��"�Q�$�i�"�Q�$���Q��&��a�)�m�)D�D���Z� �%����
�"3�3�4�4�4�s�BB3�3B<c�(�eZdZdZd�Zd�Zd�Zd�Zy)�catch_unraisable_exceptiona�
    Context manager catching unraisable exception using sys.unraisablehook.

    Storing the exception value (cm.unraisable.exc_value) creates a reference
    cycle. The reference cycle is broken explicitly when the context manager
    exits.

    Storing the object (cm.unraisable.object) can resurrect it if it is set to
    an object which is being finalized. Exiting the context manager clears the
    stored object.

    Usage:

        with support.catch_unraisable_exception() as cm:
            # code creating an "unraisable exception"
            ...

            # check the unraisable exception: use cm.unraisable
            ...

        # cm.unraisable attribute no longer exists at this point
        # (to break a reference cycle)
    c� �d|_d|_yra)�
unraisable�	_old_hookris r[rdz#catch_unraisable_exception.__init__�s�������rZc��||_yra)r�)rer�s  r[�_hookz catch_unraisable_exception._hook�s��%��rZc�Z�tj|_|jt_|Sra)r��unraisablehookr�r�ris r[r�z$catch_unraisable_exception.__enter__�s ���+�+���!�Z�Z����rZc�2�|jt_|`yra)r�r�r�r�)re�exc_infos  r[r�z#catch_unraisable_exception.__exit__�s��!�^�^����OrZN)rUrVrWrXrdr�r�r�rYrZr[r�r��s���0�%�
�
rZr�r�c	��tjdk7r�ddl}|�t}t	j
�}t
|d��D]0}tj|tj�\}}|dk7s�0n{	tj||j�tj|d�t	j
�|z
}td|�d|d�d	���tj|d�\}}tj|�}	|	|k7rtd|�d
|	�d|�d���||k7rtd
|�d|����y#t$rY��wxYw)a�
    Wait until process pid completes and check that the process exit code is
    exitcode.

    Raise an AssertionError if the process exit code is not equal to exitcode.

    If the process runs longer than timeout seconds (LONG_TIMEOUT by default),
    kill the process (if signal.SIGKILL is available) and raise an
    AssertionError. The timeout feature is not available on Windows.
    �ntrNF��errorzprocess z is still running after �.1fz secondsz exited with code z, but exit code z is expectedzpid z != pid )r�r�r]rNr�	monotonic�sleeping_retryrurv�killr[r��AssertionError�waitstatus_to_exitcode)
r*�exitcoder�r]�
start_timero�pid2rx�dt�	exitcode2s
          r[�wait_processr��sU��
�w�w�$����?�"�G��^�^�%�
���u�5�	<�A��:�:�c�2�:�:�6�L�D�&��q�y��	<�
�����V�^�^�,��
�
�3��"�
���!�J�.�B� �8�C�5�1*�*,�S���";�<�
<��z�z�#�q�)���f��)�)�&�1�I��H���x��u�,>�y�k�J.�.6�Z�|�E�F�	F��s�{��t�D�6��#��7�8�8���#�
��
�s�56D4�4	E�?Ec���ddlm}|d�|d�}tjdk(r	|j	d��yy#t
$r}t
jd|����d}~wwxYw)	z�
    Skip tests if the multiprocessing.synchronize module is missing, if there
    is no available semaphore implementation, or if creating a lock raises an
    OSError (on Linux only).
    r�)�
import_module�_multiprocessingzmultiprocessing.synchronize�linuxN)r�z broken multiprocessing SemLock: )�
import_helperr�r�r��Lockr�rxr�)r��synchronize�excs   r[�*skip_if_broken_multiprocessing_synchronizer��sv��-��$�%� � =�>�K�
�|�|�w��	P�
�����&����	P��#�#�&F�s�g�$N�O�O��	P�s�?�	A%�A � A%c��|j}|j}|dk7r|�d|��}n|�}dtj|��d�}|jt
||g|��i|��y)z�
    Check that given type cannot be instantiated using *args and **kwds.

    See bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag.
    �builtinsr�zcannot create 'z' instancesN)rVrUrr�r��	TypeError)r��tprfr�modr��qualnamerbs        r[r+r+sj��
�-�-�C�
�;�;�D�
�j���U�!�D�6�?���V���B�I�I�h�/�0��
<�C��H���y�#�r�A�D�A�D�ArZc���	ddl}|j�}t|dz
d�S#ttf$rA}	d}t	j
�}|�|dz
}|j}|��d}n#d}wxYwYd}~�Zd}~wwxYw)zvGet the recursion depth of the caller function.

    In the __main__ module, at the module level, it should be 1.
    rNr�)rQ�get_recursion_depthrD�RecursionErrorr��	_getframe�f_backr�)rQ�depthr��frames    r[r�r�s���

� �!�5�5�7���u�q�y�!����
��(�
�	��E��M�M�O�E��#���
�������#�
�E��D�E��E��
�s&�%�A5�+A$�!A0�$A(�(A0�0A5c�H�tj�}t�}||z
S)z�Get the number of available frames before RecursionError.

    It depends on the current recursion depth of the caller function and
    sys.getrecursionlimit().
    )r��getrecursionlimitr�)rr�s  r[�get_recursion_availabler�4s$��
�!�!�#�E��!�E��5�=�rZc#��K�tj�}	tj|�d��tj|�y#tj|�wxYw�w)z'Temporarily change the recursion limit.N)r�r��setrecursionlimit)r�original_limits  r[�set_recursion_limitr�>sH�����*�*�,�N�.����e�$�
����n�-�����n�-���A!�A�A!�A�A!c�~�|�d}n|dkrtd��t�}t|dz
d�}||z}t|�S)Ni N�z-max_depth must be at least 3, got {max_depth}r�)r�r�r�r�)�	max_depthr�rs   r[r>r>HsO�����	�	�Q���H�I�I��!�E����	�1��E��I��E��u�%�%rZre�likec
�t�t�}tjdt||dt	|��d�z��|S)Nr��
(?#support�))rrer�)�objectr�filterwarnings�DeprecationWarning�id)rer��tokens   r[�ignore_deprecations_fromr�Us<���H�E�����#���*�R��Y�K�q�1�1�	��LrZ�tokensc��|std��g}td�|D��}tjD]j\}}}}}|dk(rG|tur?t|tj�r
|j}n|xsd}|j|�r�U|j|||||f��ltj|k7r(|tjddtj�yy)Nz<Provide token or tokens returned by ignore_deprecations_fromc3�:K�|]}dt|��d����y�w)r�r�N)r�)r�r�s  r[r�z-clear_ignored_deprecations.<locals>.<genexpr>ds����D�E�
�2�e�9�+�Q�/�D�s�r�r%)r�r�r�filtersr�r�r�Patternr~r�r��_filters_mutated)	r��new_filtersr��actionr�rrer�rbs	         r[�clear_ignored_deprecationsr�_s�����W�X�X��K��D�V�D�D�H�5=�5E�5E�H�1����6�6��X��(�.@�"@��'�2�:�:�.��o�o���m����|�|�H�%�����F�G�X�v�v�F�G�H����;�&�)�������!�!�#�'rZc��	ddl}	ddl}tj
|d�S#t$rtjdd�cYSwxYw#t$rd}Y�HwxYw)NrTzvenv: ensurepip requires zlibzvenv: pip requires ctypes)rCrDrxr�r�rE)rCr�s  r[�requires_venv_with_pipr�tsc��F�������v�'B�C�C���F����t�%D�E�E�F�������s �!�A�A�A�A�Ac��tjd�xs$tjj	t
d�}tj|�}t|d��}|D]L}|jd�s�|dz}|j|�s�,tjj	||�cStd|�d|����)	z�Try to find a wheel with the package specified as pkgname.

    If set, the wheels are searched for in WHEEL_PKG_DIR (see ensurepip).
    Otherwise, they are searched for in the test directory.
    �
WHEEL_PKG_DIR�	wheeldataT)�reversez.whlr�z
No wheel for z
 found in )r'r(r�r�r�rs�listdirrzr�r�r�)�pkgname�	wheel_dir�	filenamesru�prefixs     r[�
_findwheelr��s����(�(��9��R�W�W�\�\��{�>�I��
�
�9�%�I��y�$�/�I��5��� � ��(���3������v�&��7�7�<�<�	�8�4�4�
5��m�G�9�J�y�k�J�
K�KrZc#�K�ddl}ddlm}|�5}tjdddd|g}t
r%t
�t
dd	j|��|j|d
��tjj||�}tjjtj�}tjdk(r"tjj|d
|�}n!tjj|d|�}|dddddtd�td�g}t
r%t
�t
dd	j|��|j|d
��|��ddd�y#1swYyxYw�w)Nrr�)�temp_cwdz-X�devz-m�venvzRun:� T)r�r\�Scripts�bin�pip�installr:�wheel)r1r�r�r�r3rr�r��runr�r�r�r�r�)�venv_dirr1r��temp_dirr�r�
python_exer�s        r[�$setup_venv_with_pip_setuptools_wheelr�s#�����#�	���x��~�~�t�U�D�&�(�C����G��&�#�(�(�3�-�(����s�$��'��w�w�|�|�H�h�/���W�W�%�%�c�n�n�5�
��<�<�7�"��W�W�\�\�$�	�:�>�F��W�W�\�\�$��z�:�F��t�U��U�I��,�'��'�"�$����G��&�#�(�(�3�-�(����s�$��'���5���s�E?�EE3�*	E?�3E<�8E?�gettotalrefcountc���|g}|j|�ddl}d�}||_|j|�t	t
d�r!d�}||_tj|��yy)an
    Keep a Python alive as long as possible.

    Create a reference cycle and store the cycle in an object deleted late in
    Python finalization. Try to keep the object alive until the very last
    garbage collection.

    The function keeps a strong reference by design. It should be called in a
    subprocess to not mark a test as "leaking a reference".
    rNc��yrarY)�encodings r[�search_funcz"late_deletion.<locals>.search_func�rsrZ�register_at_forkc��yrarYrYrZr[�atfork_funcz"late_deletion.<locals>.atfork_func�r�rZ)�before)r��codecs�	reference�registerr�r�r)r��	ref_cyclerrrs     r[�
late_deletionr�sb��&��I�
���Y����%�K��
�O�O�K� ��r�%�&�	� )���
���;�/�'rZr�c#�K�|dkrtd��tj�}||z}	d��tj�|k\rn�|r2tj�|z
}d|d�d�}|r|�d|��}t|��y�w)a�
    Run the loop body until "break" stops the loop.

    After *timeout* seconds, raise an AssertionError if *error* is true,
    or just stop if *error is false.

    Example:

        for _ in support.busy_retry(support.SHORT_TIMEOUT):
            if check():
                break

    Example of error=False usage:

        for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):
            if check():
                break
        else:
            raise RuntimeError('my custom error')

    rz!timeout must be greater than zeroNz	timeout (r�z	 seconds)r�)r�rr�r�)r��err_msgr�r��deadliner�rbs       r[�
busy_retryr�s�����,�!�|��<�=�=����!�J��G�#�H�
�
��>�>��x�'��	�
�
�^�^�
�
�
*���"�S���+����E��G�9�%�C��S�!�!�
�s�A=A?g{�G�z�?g�?)�
init_delay�	max_delayr�c#�K�|}t|||��D]*}d��tj|�t|dz|�}�,y�w)a�
    Wait strategy that applies exponential backoff.

    Run the loop body until "break" stops the loop. Sleep at each loop
    iteration, but not at the first iteration. The sleep delay is doubled at
    each iteration (up to *max_delay* seconds).

    See busy_retry() documentation for the parameters usage.

    Example raising an exception after SHORT_TIMEOUT seconds:

        for _ in support.sleeping_retry(support.SHORT_TIMEOUT):
            if check():
                break

    Example of error=False usage:

        for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):
            if check():
                break
        else:
            raise RuntimeError('my custom error')
    r�Nr�)rr�sleepr$)r�rrr r��delayros       r[r�r�	sD����4
�E�
����
6�*��
��
�
�5���E�A�I�y�)��	*�s�?Ac#��K�tj�}	tj|�d��tj|�y#tj|�wxYw�w)z>Temporarily change the integer string conversion length limit.N)r��get_int_max_str_digits�set_int_max_str_digits)�
max_digits�currents  r[�adjust_int_max_str_digitsr)4	sH�����(�(�*�G�,��"�"�:�.�
��"�"�7�+���"�"�7�+�r�i��i��uname�s390xi r�i�i�i'zskipped on s390xz.git�__pycache__c�|�t}tjj|�dk(r	|ddhz}|Sd|vr|dhz}|S)N�Doc�buildr�Modules)� _BASE_COPY_SRC_DIR_IGNORED_NAMESr�r�r�)r��names�ignoreds   r[�copy_python_src_ignorer5_	s]��.�G�	�w�w������&����	
�	
���N�
�e�	���
�	
���NrZra)z
requires zlib)z
requires gzip)zrequires bz2)z
requires lzma)z$requires co_positions / debug_ranges)r%)T)NrYrY)F)rY)�rXrUrD�
contextlib�dataclassesrrgr�rr�r�r'r�rr�rxrr�rKrLrMrNr�r�r��__file__�TEST_SUPPORT_DIRrsr�	REPO_ROOTr�rr	rnr
r�rr&r'rrrrr#�junit_xml_listrr�rr
r�r�rrrrrrrr,r-�HAVE_ASAN_FORK_BUGr8r>r�
SOCK_MAX_SIZErEr�
__getformat__r�rrrrrrTrVr[r�r0r1r�r2r6r3r4r r!r"r#r$r%�has_strftime_extensions�strftimer��
TEST_HTTP_URLrEr�r�r�rpr=rCr�r|r�r�rr9�contextmanagerr�rrrr�r�r�r�r�r�r�r�r�r�r�r�r;rDrrr"�_4GrCr%r�r rAr(rrrIrKrrNrQr5rarcr.r/rjr(�MISSING_C_DOCSTRINGS�HAVE_DOCSTRINGS�requires_docstringsrmror�rprwr:r?r<r�r�r@r�r*r�r�r(r)r�rBrrrr!rr4rFrGr7r8rWrYrlrnrGryrH�total_orderingrrIr�rJr��	hash_info�width�	NHASHBITSr�r�r�r�r+r�r�r�r>r�r�r��cacher�rrOrrr�r)rPrQr+�machiner�rR�	frozensetr2r5rYrZr[�<module>rNs���=��~��
�F�
G�G����
�	�	��
�������'��f�����
����7�7�?�?�2�7�7�?�?�8�#<�=������� 0�1�
�
�W�W�_�_�]�
+�
��G�G�O�O�J�'�	�5�I�5����=�J�=�)�E�)��X�&�&����$����
�
�
�������
���*�
�"K$�Z>�	7��6:�8��:
/� %�U�u�U��@)�e�E�e�TY�)�%�T�2����$$�
�%�
�(�H�'�'�	����!�,�,�V�4�$�&��-�-�,�-�1�:�@��l�l�g�%�
�
�L�L�#�#�F�+�	�
�S�.�
/�
��<�<�+�+�%/�!�Y�J��J�����,�
�

�,�,�&�
 ���2�v�&�L�}�+<�L�W���O�+�*�:�7�{��V�
'�&�6�w�;��&+�
<� ���<�<�7��
�"/�$�-�-��"6�%�"?��,�
����������]�F�3�
��&�&��3��4��V��,��	1�$�t�	1�41�n���	/��	/�%�%�
$�
�������/�B�$��	
��
�3����W�n�G�
�F��S�=��3�4�
����(�$���4��4�:�F��
�S�j���#�g���#�g������>�3�>�3�>�	��	��	�%�%�B.�`
�$�O�+��!�8�
� *�L�G�7�*�+�I�����/�I�4�I�4�4�5G�H�H��%�,�,�D�8�,�+�+��*�h�)�)�/�*D�F���� �J�J�
����#�<���#��#�<������<5�;��f��D��]�*OB�OB�d4�79��@B� �89�v.�*]�]�@3�D������,�37�
B�;��&+-��B��+�	����;��;�"$0�$0�N#�
��
�L�	�	�	��;��
��������*��
��������;��-�
�M�M���	��H����4�D)�)�X,0�-9�^P�2
B��.����.��.�&��S��3��6��$��$�4�$�*
D� ���L��L�.������F�3�*�+��"0�J'"�$�'"�T*�#(�C�t�*�D���,��,������������	��W�	�(�"�(�(�*�"4�"4��"?���	���	 �	 ��	'� ��	��	&� ��!�� ������G� 4� V������9K�9K�w�9V� 2�4�
�$-�
��	.�$� ���A9�
��
�s�.Z�Z�Z

Zerion Mini Shell 1.0