Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_cmd_line.cpython-310.pyc
o

�9j\��@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZm
Z
mZmZeed�Zdd�ZGdd	�d	ej�Ze�e�d
�Gdd�dej��ZGd
d�dej�Zdd�Zedkrke��dSdS)�N)�support)�	os_helper)�spawn_python�kill_python�assert_python_ok�assert_python_failure� interpreter_requires_environment�gettotalrefcountcCst|�}|��}||fS�N)r�wait)�p�data�
returncode�r�)/usr/lib/python3.10/test/test_cmd_line.py�_kill_python_and_exit_codesrc@s`eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
�e�d�dd��Z
dd�Zdd�Zdd�Zdd�Zdd�Ze
�ejd�dd��Ze
�ejd�dd ��Ze
�ejd!kd"�d#d$��Ze
�ejd!kd"�d%d&��Ze
�ejd'kpxejd(�d)d*��Zd+d,�Zd-d.�Z d/d0�Z!d1d2�Z"d3d4�Z#d5d6�Z$d7d8�Z%d9d:�Z&d;d<�Z'd=d>�Z(d?d@�Z)dAdB�Z*dCdD�Z+e
�e,j-dEkdF�e
�ejdGkdH�dIdJ���Z.dKdL�Z/dMdN�Z0dOdP�Z1dQdR�Z2dSdT�Z3dUdV�Z4dWdX�Z5e
�e�dY�dZd[��Z6d\d]�Z7d^d_�Z8d`d`da�dbdc�Z9ddde�Z:dydgdh�Z;didj�Z<dkdl�Z=dmdn�Z>dodp�Z?e
�ejd!kdq�drds��Z@dtdu�ZAdvdw�ZBdxS)z�CmdLineTestcCstd�td�dS)N�.z< .)r��selfrrr�test_directoriesszCmdLineTest.test_directoriescCsBt|�\}}}|�|dkp|�d��|�d|�|�d|�dS)N��
s	Traceback)r�
assertTrue�endswith�assertNotIn)r�cmd_line�rc�out�errrrr�verify_valid_flag"szCmdLineTest.verify_valid_flagcCs|�d�|�d�dS)Nz-Oz-OO�r rrrr�
test_optimize(s
zCmdLineTest.test_optimizecC�|�d�dS)N�-Sr!rrrr�test_site_flag,�zCmdLineTest.test_site_flagcCsBtd�\}}}|��}|�d|d�d�|dd���d�dS)Nz-hsusagerr��ascii)r�
splitlines�assertIn�join�decode)rrrr�linesrrr�
test_usage/szCmdLineTest.test_usagecCsTdtjdd��d�}dD]}t|�\}}}|�|�|��|�|�|��qdS)NzPython %d.%d�r()z-Vz	--versionz-VV)�sys�version_info�encoder�assertFalse�
startswithr)r�version�switchrrrrrr�test_version7s�zCmdLineTest.test_versioncCs8td�\}}}|�d|�td�\}}}|�d|�dS)Nz-vsstack overflowz-vv)rr�rrrrrrr�test_verbose>szCmdLineTest.test_verbosez6Cannot run -E tests when PYTHON env vars are required.cCs:dd�}|�}|�|i�|dd�}|�|ddd��dS)NcWs4tjdf|}|d7}t�|�}t|��d�}|S)N�-E)�-c� import sys; print(sys._xoptions)r)r0�
executable�
subprocess�check_output�evalr))�argsr�optsrrr�get_xoptionsJs

z/CmdLineTest.test_xoptions.<locals>.get_xoptionsz-Xaz	-Xb=c,d=eTzc,d=e)�a�b)�assertEqual)rrCrBrrr�
test_xoptionsGs
	
zCmdLineTest.test_xoptionscs��fdd�}d}|d|�\}}}��|��d���|d�|ddd|�\}}}��|��d	�tr:��|d
�dS��|d�dS)Ncsdtjg}|�|�tj}tj|||d�}|��\}}|j��|j	��|j
}��|d�|||fS)N��stdout�stderrr)r0r=�extendr>�PIPE�Popen�communicaterI�closerJrrF)rA�cmdrLrrrrrrr�
run_pythonZs



z1CmdLineTest.test_showrefcount.<locals>.run_pythonr<r;s{}r�-X�showrefcounts{'showrefcount': True}s^\[\d+ refs, \d+ blocks\])rF�rstrip�Py_DEBUG�assertRegex)rrQ�coderrrrrr�test_showrefcountYszCmdLineTest.test_showrefcountcCs0td�tdd�tddd�tdddd�dS)N�-m�
fnord43520xyz�runpy�timeit�-n�1�rrrrrr�test_run_moduleus
zCmdLineTest.test_run_modulecCs\tddddd�}|j�d�|j�d�t|�}|�|�d�d	k�|�|�d
�d	k�dS)N�-irYr\r]r^sTimer
�exit()
s1 loop���s__main__.Timer)r�stdin�writerr�find)rrr
rrr�test_run_module_bug1764407�sz&CmdLineTest.test_run_module_bug1764407cCsbt��}tj�t��d�}t�|��tddd�tddd�Wd�dS1s*wYdS)N�testrY�unittestztest/test_longexp.pyz./test/test_longexp.py)	�os�getcwd�path�dirname�__file__�removesuffixr�
change_cwdr)r�	defaultwd�projectlibpathrrr�test_relativedir_bug46421�s"�z%CmdLineTest.test_relativedir_bug46421cCs td�tdd�tdd�dS)Nr;zraise Exception�passr_rrrr�
test_run_code�s
zCmdLineTest.test_run_codezneed os_helper.FS_NONASCIIcCs"dtjttj�f}td|�dS)Nzassert(ord(%r) == %s)r;)r�FS_NONASCII�ordr)r�commandrrr�test_non_ascii�s�zCmdLineTest.test_non_asciicCs<tj}d|�d�}td|�}|�|j��t|��d��dS)Nz# coding: latin1
print(ascii('z'))r;r()rrvrrFrrTr(r2)r�chrP�resrrr�test_coding�s
 zCmdLineTest.test_coding�win32z Windows has a native unicode APIcCs�d}tj��}d|d<d|d<d|d}tjtjd|gtjtj|d	�}|�	�\}}|j
d
kr2d}n|j
dkr:d
}n	td|j
|f��|�|�sPtd||f��dS)N���C�LC_ALL�0�PYTHONCOERCECLOCALEsimport locale; print(ascii("s""), locale.getpreferredencoding())r;)rIrJ�envr's3Unable to decode the command from the command line:rs'\xff' z Unknown exit code: %s, output=%az%a doesn't start with %a)
rj�environ�copyr>rMr0r=rL�STDOUTrNr�AssertionErrorr4)r�undecodabler�rWrrIrJ�patternrrr�test_undecodable_code�s0
���
�


�z!CmdLineTest.test_undecodable_codec	s�d�tjd�g}�fdd�}�fdd�}�fdd�}d	�d
�}d}||g}|||fD],}|j|d��|D]}	||	�}
|�|
j��t|	��q5Wd�n1sQwYq*dS)
Nz;import sys, os; s=os.fsencode(sys.argv[1]); print(ascii(s))r;cs tjd�|g}tj|tjdd�S)Nr;T�rI�text�r0r=r>�runrL��argrP�rWrr�run_default�sz6CmdLineTest.test_invalid_utf8_arg.<locals>.run_defaultcs4tjd�|g}ttj�}d|d<tj|tjd|d�S)Nr;rr�T)rIr�r�)r0r=�dictrjr�r>r�rL)r�rPr�r�rr�run_c_locale�s

�z7CmdLineTest.test_invalid_utf8_arg.<locals>.run_c_localecs$tjddd�|g}tj|tjdd�S)NrR�utf8r;Tr�r�r�r�rr�
run_utf8_mode�sz8CmdLineTest.test_invalid_utf8_arg.<locals>.run_utf8_mode�e:é, euro:€, non-bmp:􏿿�utf-8s��é�������)�run_cmd)r0r=r2�subTestrFrIrTr()r�base_cmdr�r�r��
valid_utf8�invalid_utf8�	test_argsr�r��procrr�r�test_invalid_utf8_arg�s$	
�����z!CmdLineTest.test_invalid_utf8_arg�darwinz%test specific to Mac OS X and Androidc	Cs�d�d�}d}|�dd�}t|��d�d}tj��}d|d<tjtj	d	||ftj
|d
�}|��\}}|�||�|�|j
d�dS)Nr�r�z%import sys; print(ascii(sys.argv[1]))�surrogateescaper(rrr�r;)rIr�r)r2r,r(rjr�r�r>rMr0r=rLrNrFr)	rr�rW�decoded�expectedr�rrIrJrrr�test_osx_android_utf8s

�z!CmdLineTest.test_osx_android_utf8cCs@t�d�}tjd|g}tj|tjtjddd�}|�|jd�dS)Nz�
            import sys
            out = sys.stdout
            print(out.isatty(), out.write_through, out.line_buffering)
            err = sys.stderr
            print(err.isatty(), err.write_through, err.line_buffering)
        r;T)rIrJr��checkz#False False False
False False True
)	�textwrap�dedentr0r=r>r�rLrFrI)rrWrAr�rrr�%test_non_interactive_output_bufferings

��z1CmdLineTest.test_non_interactive_output_bufferingcCs�dD]>}d|}tdd|�\}}}|dkr|n|}|�|dd|�d|}tdd|�\}}}|dkr5|n|}|�|dd	|�qdS)
NrHz6import os, sys; sys.%s.buffer.write(b'x'); os._exit(0)�-ur;rJ�xzbinary %s not unbufferedz.import os, sys; sys.%s.write('x'); os._exit(0)ztext %s not unbuffered�rrF)r�streamrWrrrr
rrr�test_unbuffered_output(s���z"CmdLineTest.test_unbuffered_outputcCsTd}tdd|�}|j�d�|j��t|�\}}|�|d�|�|�d�|�dS)Nz/import sys; sys.stdout.write(sys.stdin.read(1))r�r;r�r)rrdre�flushrrFrr4)rrWrr
rrrr�test_unbuffered_input8s
z!CmdLineTest.test_unbuffered_inputcCsXd}d}|tj|}d}tdd||d�\}}}|�|�d�|�|�|�d�|�dS)N��ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE��FGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJFGHIJ��if 1:
            import sys
            path = ":".join(sys.path)
            path = path.encode("ascii", "backslashreplace")
            sys.stdout.buffer.write(path)r$r;��
PYTHONPATHr()rj�pathseprr*r2)r�path1�path2rlrWrrrrrr�test_large_PYTHONPATHBs�z!CmdLineTest.test_large_PYTHONPATHcCs<d}td|dd�\}}}td|dd�\}}}|�||�dS)Nr�r;�r�F)�
__isolatedr�)rrW�rc1�out1�err1�rc2�out2�err2rrr� test_empty_PYTHONPATH_issue16309Qsz,CmdLineTest.test_empty_PYTHONPATH_issue16309cCs�dD]B}tj��}||d<tjtjdgtjtjtj|d�}d}|j	�
t|��d�d�|j	�
d�t
|�}t|��|d	�}|�||�qdS)
N)r(zlatin-1r��PYTHONIOENCODINGra)rdrIrJr�ua=é b=� c=𐀀 d=􏿿r(rrb�backslashreplace)rjr�r�r>rMr0r=rLr�rdrer(r2r�reprr*)r�encodingr�rr�r
�escapedrrr�test_displayhook_unencodablebs"
��z(CmdLineTest.test_displayhook_unencodablec	Cs�t�d��B}tj�d�}|�|�d��|��|�d�t	j
tjd|f|t	j
d��}|��\}}Wd�n1s;wYWd�n1sJwY|�|��|�dS)Nzwb+�ASCII)sabcsdefrr;)rdrI)�tempfile�NamedTemporaryFilerj�linesepr2rer+r��seekr>rMr0r=rLrNrFrT)rrWr�rd�sepr�rIrJrrr�check_inputts

����	zCmdLineTest.check_inputcC�|�dd�dS)Nz-import sys; print(repr(sys.stdin.readline()))s'abc\n'�r�rrrr�test_stdin_readline�s�zCmdLineTest.test_stdin_readlinecCr�)Nzprint(repr(input()))s'abc'r�rrrr�test_builtin_input�s�zCmdLineTest.test_builtin_inputcCsVd}td|�\}}}tjdkr|�d|�|�d|�dS|�d|�|�d|�dS)Nz�if 1:
            import sys
            print(1)
            print(2)
            print(3, file=sys.stderr)
            print(4, file=sys.stderr)r;r}s1
2
s3
4
s1
2
s3
4
)rr0�platformrF�rrWrrrrrr�test_output_newline�s
zCmdLineTest.test_output_newlinecCs4tdd�\}}}|�|�dd�d�|�d|�dS)Nr;�'r(�ignore�SyntaxErrorr)rrVr,rFr8rrr�test_unmached_quote�szCmdLineTest.test_unmached_quotecCsDd}td|�\}}}|�d|�|�d|�|�|�dd�d�dS)Nz�if 1:
            import os, sys, test.support
            test.support.SuppressCrashReport().__enter__()
            sys.stdout.write('x')
            os.close(sys.stdout.fileno())r;r�xr(r�z"Exception ignored in.*
OSError: .*)rrFrVr,r�rrr�test_stdout_flush_at_shutdown�s�z)CmdLineTest.test_stdout_flush_at_shutdowncCs$d}td|�\}}}|�d|�dS)Nzimport sys; sys.stdout.close()r;rr�r�rrr�test_closed_stdout�szCmdLineTest.test_closed_stdout�posixztest needs POSIX semantics�vxworksz.test needs preexec support in subprocess.Popencsfdj�d�}�fdd�}tjtjdd|gtjtjtj|d�}|��\}}|�|d�|�|jd	�dS)
Nz�if 1:
            import os, sys
            for i, s in enumerate({streams}):
                if getattr(sys, s) is not None:
                    os._exit(i + 1)
            os._exit(42)��streamscs>d�vr	t�d�d�vrt�d�d�vrt�d�dSdS)NrdrrIr'rJr/)rjrOrr�rr�preexec�s

�z+CmdLineTest._test_no_stdio.<locals>.preexecr:r;)rdrIrJ�
preexec_fnr�*)	�formatr>rMr0r=rLrNrFr)rr�rWr�rrrrr�r�_test_no_stdio�s��zCmdLineTest._test_no_stdiocC�|�dg�dS)Nrd�r�rrrr�
test_no_stdin��zCmdLineTest.test_no_stdincCr�)NrIr�rrrr�test_no_stdout�r�zCmdLineTest.test_no_stdoutcCr�)NrJr�rrrr�test_no_stderr�r�zCmdLineTest.test_no_stderrcCs|�gd��dS)N)rdrIrJr�rrrr�test_no_std_streams�szCmdLineTest.test_no_std_streamscCs.|�d�g}tj�dd�dkrttj�}|d=d|d<ni}td�D]}d}td|fi|��\}}}|�|d	�|�|�q#t	t
|��}|jt|�d
d�
|�d�d
}td|dd�\}}}|�d|�td|dd�\}}}|�d|�td|dd�\}}}|�d|�tdd|dd�\}}}|�d|�dS)Nz-R�PYTHONHASHSEED�randomr^�
__cleanenv�zprint(hash("spam"))r;rr'z83 runs produced an identical random hash  for "spam": {})�msgz<import sys; print("random is", sys.flags.hash_randomization)r��r�srandom is 1r�srandom is 0)r rjr��getr��rangerrF�append�sorted�set�
assertGreater�lenr�r*)r�hashesr��irWrrrrrr�test_hash_randomization�s4


�z#CmdLineTest.test_hash_randomizationcCsftj}|�tj|�t|ddd��}td|d�td|d�Wd�n1s(wYt|�dS)N�wr��r�z
import sys)�filezdel sys.modules['__main__'])r�TESTFN�
addCleanup�unlink�open�printr)r�filename�scriptrrr�test_del___main__s�zCmdLineTest.test_del___main__cCs�tdd�\}}}|�d|�|�|���d�d�|�d|�tddd�\}}}|�d|�|�|���d�d�|�d|�tdddd�\}}}|�d|�|�d|�|�|���d�d�|�d|�dS)	Nr:z-zsUnknown option: -zr'r)�withoutz-asUnknown option: -a)rr*rFr)�countrr8rrr�test_unknown_optionssz CmdLineTest.test_unknown_options�6Cannot run -I tests when PYTHON env vars are required.c	CsD|�d�|�d�tddddd�\}}}|�|��d�t���w}tj�|d�}tj�|d	�}t	|d
dd��
}|�
d
�Wd�n1sGwYt	|d
dd��}|�
d�|�
d�Wd�n1shwY|jtj
tjtj|g|tjd�tjtjd|g|d�}|�|��d�Wd�dS1s�wYdS)N�-Iz-IEsr;zSfrom sys import flags as f; print(f.no_user_site, f.ignore_environment, f.isolated)r�)�dummyvars1 1 1zuuid.pyzmain.pyr�r�r�z)raise RuntimeError('isolated mode test')
zimport uuid
zprint('ok')
)�cwdrJ)rsok)r rrF�stripr�temp_cwdrjrlr+rre�assertRaisesr>�CalledProcessErrorr?r0r=�DEVNULL)rrrr�tmpdir�fake�main�frrr�test_isolatedmode%s6

�
�
�
��"�zCmdLineTest.test_isolatedmodec	Cs~dD]:\}}t||||d�}tt|��}d|�d|�d�}|j|d��td|fi|��Wd�n1s7wYqdS)N))r�r)r^r')r�r')�2r/��PYTHONDEBUG�PYTHONOPTIMIZE�PYTHONDONTWRITEBYTECODE�
PYTHONVERBOSEz�import sys; sys.stderr.write(str(sys.flags)); sys.exit(not (
                    sys.flags.debug == sys.flags.optimize ==
                    sys.flags.verbose ==
                    z:
                    and sys.flags.dont_write_bytecode == z
                )))�envar_valuer;)r��int�boolr�r)r�valuer��env_vars�dont_write_bytecoderWrrr�test_sys_flags_set@s&����
���zCmdLineTest.test_sys_flags_setc

Cst�}dddddd|dfg}|D]s\}}}|durdnd|�d	�}d
|�d�}d|g}|dur1ind
|i}	||urBddg|dd�<n|durQdd|��g|dd�<|j||d��#t���t|i|	��Wd�n1sowYWd�n1s~wYqdS)N)NNN)�fooNr')N�barr()r'r(r()r'r�Nr'zis Nonez== "�"z,import sys; sys.exit(not sys.pycache_prefix �)r;�PYTHONPYCACHEPREFIXrR�pycache_prefixrzpycache_prefix=)�envval�opt)�objectr�rrr)
r�NO_VALUE�casesr-r.r��
exp_clauserWrAr�rrr�test_set_pycache_prefixWs2�	
�����z#CmdLineTest.test_set_pycache_prefixT)�check_exitcode�xdevcGs�ttj�}|�dd�|�dd�|�dd�|r#tjddg|�R}ntjg|�R}tj|tjtj	d|d�}|r@|�
|jd|�|j�
�S)	N�PYTHONWARNINGS�
PYTHONDEVMODE�PYTHONMALLOCrR�devT�rIrJ�universal_newlinesr�r)r�rjr��popr0r=r>r�rLr�rFrrIrT)rr4r5rAr�r�rrr�run_xdevqs 
�
zCmdLineTest.run_xdevcCs~d}|jd|dd�}|�|d�|�d|�}|�|d�d}tr#d}nd	}|�d|�}|�||�|�d
d|�}|�|d|���|�dd|�}|�|d
|���|�dd|�}|�|d|���zddl}Wn	typYn.wd}t���|jd|dd�}Wd�n1s�wYt��r�d}nd}|�||�zddl}Wn
ty�YdSwd}|�d|�}|�|d�dS)N�%import sys; print(sys.flags.dev_mode)r;F)r5�False�Truez\import warnings; print(' '.join('%s::%s' % (f[0], f[2].__name__) for f in warnings.filters))zdefault::Warningz�default::Warning default::DeprecationWarning ignore::DeprecationWarning ignore::PendingDeprecationWarning ignore::ImportWarning ignore::ResourceWarningz-bzdefault::BytesWarning �-bbzerror::BytesWarning z-Werrorzerror::Warning r�<import _testcapi; print(_testcapi.pymem_getallocatorsname()))r4�pymalloc_debug�malloc_debugz5import faulthandler; print(faulthandler.is_enabled()))	r=rFrU�	_testcapi�ImportErrorr�SuppressCrashReport�
with_pymalloc�faulthandler)rrWr�expected_filtersrE�
alloc_namerIrrr�	test_xdev�sL�
��zCmdLineTest.test_xdevFcCsx|rd}nd}|d7}tjd|dd|f}ttj�}|�dd�||d<tj|tjtj	d	|d
�}|�
|jd|�|j�
�S)Nz�import sys; from test.support.import_helper import import_fresh_module; warnings = import_fresh_module('warnings', blocked=['_warnings']); zimport sys, warnings; zKprint(' '.join('%s::%s' % (f[0], f[2].__name__) for f in warnings.filters))z-WrAr;r7r6Tr:r)r0r=r�rjr�r<r>r�rLr�rFrrIrT)r�cmdline_option�envvar�
use_pywarningrWrAr�r�rrr�check_warnings_filters�s 
�
z"CmdLineTest.check_warnings_filterscCsHd}ts|d7}|�dd�}|�||�|jdddd�}|�||�dS)Nz9error::BytesWarning once::UserWarning always::UserWarningz� default::DeprecationWarning ignore::DeprecationWarning ignore::PendingDeprecationWarning ignore::ImportWarning ignore::ResourceWarningzonce::UserWarningzalways::UserWarningT)rO)rUrPrF)rrJrrrr�test_warnings_filter_precedence�s��z+CmdLineTest.test_warnings_filter_precedencecCs�d}ttj�}|�dd�|dur||d<n|�dd�tjd|f}tj|tjtj	d|d�}|�
|j��|�|�
|j
d�dS)NrBr7r8r;Tr:r)r�rjr�r<r0r=r>r�rLr�rFrIrTr)r�env_var�namerWr�rAr�rrr�check_pythonmalloc�s

�zCmdLineTest.check_pythonmallocc	Cs�t��}|rtr
dnd}d}ntrdnd}d}d|fd|fddg}|r(|�d�|D]!\}}|j||d	��|�||�Wd�n1sFwYq*dS)
NrC�pymallocrD�malloc�debug)rVrV)rDrD))rUrU)rCrC)rRrS)rrHrUrKr�rT)rrU�default_name�default_name_debug�testsrRrSrrr�test_pythonmalloc�s&�
���zCmdLineTest.test_pythonmalloccCs�d}ttj�}|�dd�tjd|f}tj|tjd|d�}|�	|j
��d�|�	|jd|�d|d<tj|tjd|d�}|�	|j
��d	�|�	|jd|�dS)
Nr>r7r;T)rIr;r�r?rr^r@)
r�rjr�r<r0r=r>r�rLrFrIrTr)rrWr�rAr�rrr�test_pythondevmode_envs

�
�z"CmdLineTest.test_pythondevmode_envz!bpo-32457 only applies on WindowscCsbtjddf}tj�tj�\}}|d|}tj|tj|d�}|�|j	d|�|�|j
��d�dS)Nr;zprint(0)z\.\.\.\)rIr=r�0)r0r=rjrl�splitr>r�rLrFrrIr)rrA�prefix�exer=r�rrr�test_argv0_normalization&s
�z$CmdLineTest.test_argv0_normalizationcCsNtjddg}tj|tjtjdd�}d}|�|j�|�|j�|�|j	d�dS)Nr
z--unknown-optionT)rIrJr�z'unknown option --unknown-option
usage: r)
r0r=r>r�rLrrJr4�assertNotEqualr)rrAr��err_msgrrr�test_parsing_error2s�zCmdLineTest.test_parsing_errorcCsBd}tddd|�tddd|�tddd|�tddd|dd�td|d	d�td|d
d�dd�}td|�}|�||�d
t��f�tddd|�}|�||�d�tddd|�}|�||�d�tddd|�}|�||�d�td|dd�}|�||�d�td|dd�}|�||�d�tddd|dd�}|�||�d�dS)NzMimport sys; print(sys.flags.int_max_str_digits, sys.get_int_max_str_digits())rR�int_max_str_digitsr;zint_max_str_digits=foozint_max_str_digits=100�4000)�PYTHONINTMAXSTRDIGITSr'�100cSs&|j���d�}tdd�|��D��S)Nr�css�|]}t|�VqdSr
)r!)�.0r�rrr�	<genexpr>Js�zGCmdLineTest.test_int_max_str_digits.<locals>.res2int.<locals>.<genexpr>)rrr,�tupler^)r{rrrr�res2intHsz4CmdLineTest.test_int_max_str_digits.<locals>.res2intrczint_max_str_digits=0)rrzint_max_str_digits=4000)�rmzint_max_str_digits=100000)順rnr�zint_max_str_digits=6000)�pro)rrrFr0�get_int_max_str_digits)rrWrlr{rrr�test_int_max_str_digits<s6
�
�z#CmdLineTest.test_int_max_str_digitsN)F)C�__name__�
__module__�__qualname__rr r"r%r.r7r9ri�skipIfrrGrXr`rgrsru�
skipUnlessrrvryr|r0r�r�r�r�
is_androidr�r�r�r�r�r�r�r�r�r�r�r�r�r�rjrSr�r�r�r�r�r�rrrr&r3r=rLrPrQrTr[r\rardrqrrrrrs�	�
	

�
!�
+�

	�%�

;�


rrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�IgnoreEnvironmentTestcKsd�|�}tdd|fi|��S)Nz@import sys; sys.stderr.write(str(sys.flags)); sys.exit(not ({}))r:r;)r�r)r�	predicater$rWrrr�run_ignoring_varsds
z'IgnoreEnvironmentTest.run_ignoring_varscCsd}|jd�|�|d�dS)N�should_be_ignoredz'{}' not in sys.pathr�)rzr�)rrlrrr�test_ignore_PYTHONPATHls
�z,IgnoreEnvironmentTest.test_ignore_PYTHONPATHcCs|jddd�dS)Nz!sys.flags.hash_randomization == 1r�r��rzrrrr�test_ignore_PYTHONHASHSEEDqs
�z0IgnoreEnvironmentTest.test_ignore_PYTHONHASHSEEDcCsd}|j|ddddd�dS)Nz�
            (sys.flags.debug == sys.flags.optimize ==
             sys.flags.dont_write_bytecode == sys.flags.verbose == 0)
        r^rr})r�expected_outcomerrr�test_sys_flags_not_setus
�z,IgnoreEnvironmentTest.test_sys_flags_not_setN)rrrsrtrzr|r~r�rrrrrx`s
rxc@s$eZdZdd�Zdd�Zdd�ZdS)�SyntaxErrorTestscCsJtjtjdg|tjtjd�}|�|jd�|�|jd�|�d|j�dS)N�-)�inputrIrJrs
SyntaxError)	r>r�r0r=rLrbrrJr*)rrWr�rrr�check_string�s�zSyntaxErrorTests.check_stringcCr#)Ns(1+2+3�r�rrrr�test_tokenizer_error_with_stdin�r&z0SyntaxErrorTests.test_tokenizer_error_with_stdincCr#)Ns'\u1f'r�rrrr�*test_decoding_error_at_the_end_of_the_line�r&z;SyntaxErrorTests.test_decoding_error_at_the_end_of_the_lineN)rrrsrtr�r�r�rrrrr��sr�cCst��dSr
)r�
reap_childrenrrrr�tearDownModule�sr��__main__)rjr>r0r�r�rirhr�test.supportr�test.support.script_helperrrrrr�hasattrrUr�TestCaserrurxr�r�rrrrrrr�<module>s6
I�!�

Youez - 2016 - github.com/yon3zu
LinuXploit