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_imp.cpython-310.pyc
o

�9j�K�@s6ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddl	mZddl	mZddl
Z
ddlZe���e�de�ddlZWd�n1sUwYddlZdd�ZGd	d
�d
e
j�ZGdd�de
j�ZGd
d�de
j�ZGdd�de
j�ZGdd�de
j�Zedkr�e
��dSdS)�N)�support)�
import_helper)�	os_helper)�
script_helper�ignorecCs"t�|�}t�ttd�d�|�S)zXDecorator to skip a test if not running under CPython or lacking
    imp.load_dynamic().�load_dynamiczimp.load_dynamic() required)r�cpython_only�unittest�skipIf�hasattr�imp)�meth�r�$/usr/lib/python3.10/test/test_imp.py�requires_load_dynamics
��rc@s eZdZdZdd�Zdd�ZdS)�	LockTestsz)Very basic test of import lock functions.cCs|�t��|d|�dS)Nz!expected imp.lock_held() to be %r)�assertEqualr�	lock_held)�self�expectedrrr�verify_lock_state s�zLockTests.verify_lock_statecCs�d}t��}|�|�t|�D]}t��|�d�qt|�D]}t��q|�|�|sEzt��Wn
ty=YdSw|�d�dSdS)N�2Tz5release_lock() without lock should raise RuntimeError)rrr�range�acquire_lock�release_lock�RuntimeError�fail)r�LOOPS�lock_held_at_start�irrr�testLock#s"


��zLockTests.testLockN)�__name__�
__module__�__qualname__�__doc__rr rrrrrsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
edd��Zedd��Z
edd��Zedd��Zedd��Ze�ejd�dd��Zdd�Zd d!�Zejd"d#��Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zejd,d-��Zd.S)/�ImportTestscCst�d�}|j|_|j|_dS)Nztest.encoded_modules)�	importlib�
import_module�test_strings�__path__�	test_path)r�modrrr�setUp?s
zImportTests.setUpcCs2|jD]\}}}t�d|�}|�||j�qdS)Nztest.encoded_modules.module_)r(r&r'r�test)r�modname�encoding�teststrr+rrr�test_import_encoded_moduleDs��z&ImportTests.test_import_encoded_modulec	Cs�|jD]'\}}}t�d||j�d�}|�|j|�Wd�n1s%wYqtj�t	�g}|�
t��t�d|�Wd�dS1sIwYdS)N�module_r�badsyntax_pep3120)r(r�find_moduler*rr/�os�path�dirname�__file__�assertRaises�SyntaxError)rr+r/�_�fdr6rrr�test_find_module_encodingJs��"�z%ImportTests.test_find_module_encodingc	Cs|jD]B\}}}t�d||j�\}}}|�'|�|d�|�|j|�|�|��d�|�|��d|�Wd�n1s@wYqt�d�\}}}|�&|�|d�|�|jd�|�|��d�|�|��d�Wd�dS1sywYdS)Nr2rz# test %s encoding
�tokenize�utf-8z*"""Tokenization help for Python programs.
)	r(rr4r*�assertNotEqualrr/�tell�readline)rr+r/r;�fp�filename�inforrr�test_issue1267Ss,

����
�"�zImportTests.test_issue1267c
Cs�d}tj�dd�zFt|dddd��
}|�d�Wd�n1s#wYt�|�\}}}|��|�|j	d	�Wtjd=t
�|d�t
�|d
�dStjd=t
�|d�t
�|d
�w)N�test_imp_helperr�.�.py�wzlatin-1�r/z%# coding: cp1252
u = 'test.test_imp'
�cp1252�.pyc)�sysr6�insert�open�writerr4�closerr/r�unlink)r�
temp_mod_name�filerDrErrr�test_issue3594fs��zImportTests.test_issue3594cCsVt��}ddddddddddd�
}tjdkr|�|d�d	}n|�|�}|s-|�d
|�|�|�}d|}d|}tj�	|d
�}�zEtj�
dtj�t|dddd��
}|�
d�Wd�n1sdwYt�|�\}}	}
|�A|�|�|�|	dd��|��|�|
dd�|�|
dd�|�|
dtj�t�|||	|
�}|�|jd�Wd�n1s�wYt���t�d�t�||d�}Wd�n1s�wY|�|jd�t���t�d�tjs�t�|t�|d��}Wd�n	1�swY|�|jd�tj�|��st�|�t|ddd��
}|�
d�Wd�n	1�s7wYt���t�d�t�||�}Wd�n	1�sWwY|�|j d�Wtjd=dD]}
t!�"||
�t!�"||
��qjt!�#|�t!�#d�dStjd=dD]}
t!�"||
�t!�"||
��q�t!�#|�t!�#d�w)Ns�������)
r?�cp1250�cp1251rL�cp1253�cp1254�cp1255�cp1256�cp1257�cp1258�darwinr?säz2can't run this test with %s as filesystem encoding�test_imp_helper_�test_imp_helper_package_z__init__.pyrrIrJrKza = 1
�����r�rzb = 2
)rIrM�__pycache__)$rN�getfilesystemencoding�platformr�get�skipTest�decoder5r6�joinrO�curdirrPrQrr4�assertIsNotNone�
assertTrue�endswith�	PY_SOURCE�load_module�a�warnings�catch_warnings�simplefilter�load_source�dont_write_bytecode�
load_compiled�cache_from_source�exists�mkdir�load_package�brrS�rmtree)r�fs_encoding�
known_locales�special_char�decoded_charrT�test_package_name�init_file_namerUrDrEr+�package�extrrr�test_issue5604ts��


�
�
�


�

���
�

�
�
zImportTests.test_issue5604cCs$tj�t�}|�ttjd|g�dS)Nr3)r5r6r7r8r9r:rr4)rr6rrr�test_issue9319�s
�zImportTests.test_issue9319cCs�tj}tj}t���3t�d�}|�|dj�tj	dg|�R�}|�
t|�|�
||j�|�||j�Wd�dS1s@wYdS)Nr5r)r5r6�getenvr�EnvironmentVarGuardrr4�
addCleanuprRrv�assertIs�assertIsNot)r�	orig_path�orig_getenv�x�new_osrrr�test_load_from_source�s	

"�z!ImportTests.test_load_from_sourcecCsNd}t�|�}|d}|dur|�|j�tj|g|�R�}|�|j|�dS)N�_heapqr)rr4r�rRrvrr!)r�exampler��file_r+rrr�test_issue15828_load_extensions�s
z+ImportTests.test_issue15828_load_extensionscCs�d}t�|�\}}}|��t�||�}t�d|�}t�d|�}|�|j|�|�|jd�|�|jd�|�t��t�d|�Wd�dS1sLwYdS)N�_testimportmultiple�_testimportmultiple_foo�_testimportmultiple_bar�nonexistent)rr4rRrrr!r9�ImportError)r�m�fileobj�pathname�description�mod0�mod1�mod2rrr�+test_issue16421_multiple_modules_in_one_dll�s"�z7ImportTests.test_issue16421_multiple_modules_in_one_dllcCsbd}d}|�t��}t�||�Wd�n1swY|�||jj�|�||jj�dS)Nzbogus file path�	extension)	r9r�rr�assertIn�	exceptionr6r�name)rr6r��errrrr�"test_load_dynamic_ImportError_path�s�z.ImportTests.test_load_dynamic_ImportError_pathcCsbd}t�|�}|ddur|d��|ddtjkr!|�d�tj|dg|dd��R�dS)Nr�rriz/found module doesn't appear to be a C extensionrg)rr4rR�C_EXTENSIONrnrv)rr��foundrrr�'test_load_module_extension_file_is_None
s

 z3ImportTests.test_load_module_extension_file_is_NonecCs�d}ztj|=Wn	tyYnwzUt�|�}tj�d�}t�||j	�}|�
|j|�|�
|jj
|�|�
|jj	|j	�|�tt|d�|�
|jd�|�tj||�Wztj|=WdStygYdSwztj|=WwtywYww)Nztest.imp_dummy�_testmultiphase�
dummy_namei�)rN�modules�KeyErrorr&r'�util�	find_specrr�originrr!�__spec__r�r9�AttributeError�getattr�	int_constr�)rr��module�specrrr�3test_issue24748_load_module_skips_sys_modules_checks4�
���z?ImportTests.test_issue24748_load_module_skips_sys_modules_checkz*test meaningful only when writing bytecodecCsZt���tjd}t�|�|�tdtjtjdg�Wd�dS1s&wYdS)NrIz
^No modulerH)	r�temp_cwd�TESTFNr5r��assertRaisesRegexr�rr4)r�sourcerrr�test_bug7732.s


�"�zImportTests.test_bug7732cCs6t�dtjttjdd��}|�tj�|�tj�dS)Nrr?rK)r�_LoadSourceCompatibilityr8rP�get_data)r�loaderrrr�test_multiple_calls_to_get_data7s

�z+ImportTests.test_multiple_calls_to_get_datac	Cs�dt��}ttjt�|�}t�tj||��/|�td��t�	|t
d�Wd�n1s0wYWd�dSWd�dS1sHwYdS)N�tmpz
embedded null�)r!�typerNr�r�	swap_itemr��
ValueErrorrr{r8)rr.r+rrr�test_load_source>s
��"�zImportTests.test_load_sourcecCsTt�td�}Gdd�d�}|�t��||��Wd�dS1s#wYdS)N�create_dynamicc@seZdZdZdZdS)z,ImportTests.test_issue31315.<locals>.BadSpecN�foo)r!r"r#r�r�rrrr�BadSpecLsr�)r�
get_attributerr9�	TypeError)rr�r�rrr�test_issue31315Gs
"�zImportTests.test_issue31315cCs4ddl}|�|jjd�ddl}|�|jjd�dS)Nr�frozen)�_frozen_importlib_externalrr�r��_frozen_importlib)rr�r�rrr�test_issue_35321RszImportTests.test_issue_35321cCs,|�t�dd�d�|�t�dd�d�dS)N�*shis��Z
:}��+s��65���9)r�_imp�source_hash)rrrr�test_source_hash]szImportTests.test_source_hashcCshgdfddgdfddgdfddgdfg}|D]\}}|ddg}tj|�}|�|j���d�|�qdS)N�defaultz--check-hash-based-pycs�always�neverz-cz.import _imp; print(_imp.check_hash_based_pycs)r?)r�assert_python_okr�out�stripro)r�cases�interp_argsr�args�resrrr�'test_pyc_invalidation_mode_from_cmdlineas


��
�z3ImportTests.test_pyc_invalidation_mode_from_cmdlinec	Cs�t���?tdd��
}|�d�Wd�n1swYtjddtjjd�tj	ddgd�\}}}t�
d|||�}Wd�n1sFwY|�|jd	�dS)
Nzmymod.py�wbsx = 42
T)�doraise�invalidation_mode�mymodrH)r6r�)
rr�rPrQ�
py_compile�compile�PycInvalidationMode�CHECKED_HASHrr4rvrr�)rrCrUr6r�r+rrr�test_find_and_load_checked_pycps
���
z*ImportTests.test_find_and_load_checked_pyccs^ddl�t�td�}Gdd�d�}|�����fdd�}|�t�d�}��|d�|�dS)Nr�create_builtinc@seZdZdZdS)z7ImportTests.test_create_builtin_subinterp.<locals>.Spec�builtinsN)r!r"r#r�rrrr�Spec�sr�csBt���}t���}��|����t���|d�t��dS)Nrg)rN�getrefcountr�r�r�r�gc�collect)�refcntr+�r�rr�rr�check_get_builtins�s


zEImportTests.test_create_builtin_subinterp.<locals>.check_get_builtinszimport builtins)r�rr�r��run_in_subinterpr)rr�r�r��retrr�r�test_create_builtin_subinterps

z)ImportTests.test_create_builtin_subinterpN) r!r"r#r,r1r=rFrVr�r�r�rr�r�r�r�r�r	r
rNr|r�r�r�rrr�r�r�r�r�r�rrrrr%>sB	W




�
	

r%c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�ReloadTestszPVery basic tests to make sure that imp.reload() operates just like
    reload().cCs@t���ddl}t�|�Wd�dS1swYdS)Nr)rr�r5r�reload)rr5rrr�test_source�s
"�zReloadTests.test_sourcecC�Bt�d��ddl}t�|�Wd�dS1swYdS)N�timer)r�CleanImportrrr�)rrrrr�test_extension��"�zReloadTests.test_extensioncCr)N�marshalr)rrrrr�)rrrrr�test_builtin�rzReloadTests.test_builtincsjddlm}tj�d���fdd�}|�|�|�td��t�	|�Wd�dS1s.wYdS)Nr)�parser�htmlcs�tjd<dS)Nr	)rNr�r�r	rr�cleanup�sz5ReloadTests.test_with_deleted_parent.<locals>.cleanup)
r	rrNr��popr�r�r�rr�)rrrrr
r�test_with_deleted_parent�s
"�z$ReloadTests.test_with_deleted_parentN)r!r"r#r$rrrr
rrrrr��sr�c@sPeZdZdZe��Ze�e	j
jdud�dd��Ze�e	j
jdud�dd��Z
dS)	�PEP3147TestszTests of PEP 3147.Nz1requires sys.implementation.cache_tag not be Nonec	CsFtj�dddd�}tj�ddddd�|j��}|�t�|d�|�dS)Nr��bar�baz�qux.pyrj�
qux.{}.pycT)r5r6rp�format�tagrrr~�rr6�expectrrr�test_cache_from_source�s

�z#PEP3147Tests.test_cache_from_sourcez4requires sys.implementation.cache_tag to not be Nonec	CsDtj�ddddd�|j��}tj�dddd�}|�t�|�|�dS)Nr�rrrjrr)r5r6rprrrr�source_from_cacherrrr�test_source_from_cache�s

�z#PEP3147Tests.test_source_from_cache)r!r"r#r$r�get_tagrr	�
skipUnlessrN�implementation�	cache_tagrrrrrrr�s�
�rc@s&eZdZe�ejdud�dd��ZdS)�NullImporterTestsNzNeed an undecodeable filenamec	Cs>tj}t�|�z|�ttj|�Wt�|�dSt�|�w)N)	r�TESTFN_UNENCODABLEr5r�r9r�r�NullImporter�rmdir)rr�rrr�test_unencodeable�s

z#NullImporterTests.test_unencodeable)r!r"r#r	r
rrr"rrrrr�s
�r�__main__)r�r&�importlib.utilr5�os.pathr�rNr-r�test.supportrrrr	rxryrz�DeprecationWarningrr�r�TestCaserr%r�rrr!�mainrrrr�<module>s:

�"`&�

Youez - 2016 - github.com/yon3zu
LinuXploit