403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.217.130
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_code.cpython-36.opt-1.pyc
3

�w2_�)�@s�dZddlZddlZddlZddlZddlZyddlZWnek
rPdZYnXddlm	Z	m
Z
mZmZdd�Z
dd�Zdd	�ZGd
d�dej�Zdd
�ZGdd�dej�ZGdd�dej�Zedd�o�edk	�rrejZejdej�ZejZefe_eje_ejZ ej!ejejfe _ej"e _ej#Z$ej!ejej%ej�fe$_ej"e$_da&dd�Z'ee'�Z(ee(�Z)Gdd�dej�Z*ddd�Z+e,dk�r�e+�dS)a7This module includes tests of the code object representation.

>>> def f(x):
...     def g(y):
...         return x + y
...     return g
...

>>> dump(f.__code__)
name: f
argcount: 1
kwonlyargcount: 0
names: ()
varnames: ('x', 'g')
cellvars: ('x',)
freevars: ()
nlocals: 2
flags: 3
consts: ('None', '<code object g>', "'f.<locals>.g'")

>>> dump(f(4).__code__)
name: g
argcount: 1
kwonlyargcount: 0
names: ()
varnames: ('y',)
cellvars: ()
freevars: ('x',)
nlocals: 1
flags: 19
consts: ('None',)

>>> def h(x, y):
...     a = x + y
...     b = x - y
...     c = a * b
...     return c
...

>>> dump(h.__code__)
name: h
argcount: 2
kwonlyargcount: 0
names: ()
varnames: ('x', 'y', 'a', 'b', 'c')
cellvars: ()
freevars: ()
nlocals: 5
flags: 67
consts: ('None',)

>>> def attrs(obj):
...     print(obj.attr1)
...     print(obj.attr2)
...     print(obj.attr3)

>>> dump(attrs.__code__)
name: attrs
argcount: 1
kwonlyargcount: 0
names: ('print', 'attr1', 'attr2', 'attr3')
varnames: ('obj',)
cellvars: ()
freevars: ()
nlocals: 1
flags: 67
consts: ('None',)

>>> def optimize_away():
...     'doc string'
...     'not a docstring'
...     53
...     0x53

>>> dump(optimize_away.__code__)
name: optimize_away
argcount: 0
kwonlyargcount: 0
names: ()
varnames: ()
cellvars: ()
freevars: ()
nlocals: 0
flags: 67
consts: ("'doc string'", 'None')

>>> def keywordonly_args(a,b,*,k1):
...     return a,b,k1
...

>>> dump(keywordonly_args.__code__)
name: keywordonly_args
argcount: 2
kwonlyargcount: 1
names: ()
varnames: ('a', 'b', 'k1')
cellvars: ()
freevars: ()
nlocals: 3
flags: 67
consts: ('None',)

�N)�run_doctest�run_unittest�cpython_only�check_impl_detailccs8x2|D]*}t|�}|jd�r*d|jVq|VqWdS)z.Yield a doctest-safe sequence of object reprs.z<code objectz<code object %s>N)�repr�
startswith�co_name)�tZelt�r�r�3/opt/alt/python36/lib64/python3.6/test/test_code.py�constsvs


r
c	Cs@x&dD]}td
|t|d|�f�qWtdtt|j���d
S)z1Print out a text representation of a code object.�name�argcount�kwonlyargcount�names�varnames�cellvars�freevars�nlocals�flagsz%s: %sZco_zconsts:N)	rrrrrrrrr)�print�getattr�tupler
�	co_consts)�co�attrrrr�dumpsrcCsdt�j|���S)NzForeign getitem: )�super�__getitem__)�self�irrr�external_getitem�sr"c@s$eZdZedd��Zedd��ZdS)�CodeTestcCsDddl}|jddd�}|j|jd�|j|jd�|j|jd�dS)Nr�filename�funcname�)�	_testcapiZ
code_newempty�assertEqual�co_filenamer�co_firstlineno)r r'rrrr�
test_newempty�s
zCodeTest.test_newemptycs�ddlm�m�dd���fdd�����fdd�}Gd	d
�d
t�}||dt�|j}|jdj}|j||�|j	|j
jtj
@t|j
j��|dd
dg�}|j|dd�dS)Nr)�FunctionType�CodeTypecs�fdd�jS)Ncs�S)Nrr)�	__class__rr�<lambda>�szICodeTest.test_closure_injection.<locals>.create_closure.<locals>.<lambda>)�__closure__)r.r)r.r�create_closure�sz7CodeTest.test_closure_injection.<locals>.create_closurecsF�|j|j|j|j|j|j|j|j|j|j	|j
|j|j|j
d|j�S)z9A new code object with a __class__ cell added to freevarsr.)r.)�co_argcount�co_kwonlyargcount�
co_nlocals�co_stacksize�co_flags�co_coder�co_names�co_varnamesr)rr*�	co_lnotab�co_freevars�co_cellvars)�c)r-rr�new_code�s
z1CodeTest.test_closure_injection.<locals>.new_codec	s6�|j�}�|�}|j}t||�|t�|||��dS)N)�__code__�__defaults__�setattr�globals)�clsr�f�codeZclosureZdefaults)r,r1r>rr�add_foreign_method�s
z;CodeTest.test_closure_injection.<locals>.add_foreign_methodc@seZdZdS)z-CodeTest.test_closure_injection.<locals>.ListN)�__name__�
__module__�__qualname__rrrr�List�srJr���zForeign getitem: 1)�typesr,r-�listr"rr0�
cell_contentsZassertIs�assertFalser?r6�inspectZ	CO_NOFREE�hexr()r rFrJZfunctionZ	class_ref�objr)r-r,r1r>r�test_closure_injection�szCodeTest.test_closure_injectionN)rGrHrIrr+rUrrrrr#�sr#cCs|tjd|ddd��kS)N�_rK���)�sys�intern)�srrr�
isinterned�sr[c@s`eZdZdd�Zdd�Zdd�Zedd��Zed	d
��Zedd��Z	ed
d��Z
edd��ZdS)�CodeConstsTestcCs4x|D]}||kr|SqW|j||�|jd�dS)NzShould never be reached)ZassertIn�fail)r r
�value�vrrr�
find_const�s

zCodeConstsTest.find_constcCst|�s|jd|f�dS)NzString %r is not interned)r[r])r rZrrr�assertIsInterned�szCodeConstsTest.assertIsInternedcCst|�r|jd|f�dS)NzString %r is interned)r[r])r rZrrr�assertIsNotInterned�sz"CodeConstsTest.assertIsNotInternedcCs(tddd�}|j|jd�}|j|�dS)Nzres = "str_value"�?�exec�	str_value)�compiler`rra)r rr_rrr�test_interned_string�sz#CodeConstsTest.test_interned_stringcCs,tddd�}|j|jd�}|j|d�dS)Nzres = ("str_value",)rcrdrer)re)rfr`rra)r rr_rrr�test_interned_string_in_tuple�sz,CodeConstsTest.test_interned_string_in_tuplecCs4tddd�}|j|jtd��}|jt|�d�dS)Nzres = a in {"str_value"}rcrdrer)re)rfr`r�	frozensetrar)r rr_rrr�!test_interned_string_in_frozenset�sz0CodeConstsTest.test_interned_string_in_frozensetcCsddd�}|j|��dS)NrecSs|S)Nr)�arrrrD�sz6CodeConstsTest.test_interned_string_default.<locals>.f)re)ra)r rDrrr�test_interned_string_default�s
z+CodeConstsTest.test_interned_string_defaultcCs(tddd�}|j|jd�}|j|�dS)Nzres = "str\0value!"rcrdz
strvalue!)rfr`rrb)r rr_rrr�test_interned_string_with_null�sz-CodeConstsTest.test_interned_string_with_nullN)rGrHrIr`rarbrrgrhrjrlrmrrrrr\�sr\c@seZdZdd�ZdS)�CodeWeakRefTestcsni}tdt�|�|d}~d�_�fdd�}tj|j|�}�jt|���~�jt|����j�j�dS)Nz
def f(): passrDFcs
d�_dS)NT)�called)rE)r rr�callback�sz,CodeWeakRefTest.test_basic.<locals>.callback)	rdrBro�weakref�refr?Z
assertTrue�boolrQ)r �	namespacerDrpZcoderefr)r r�
test_basic�szCodeWeakRefTest.test_basicN)rGrHrIrurrrrrn�srnT)�cpythoncCs|adS)N)�
LAST_FREED)Zptrrrr�myfreesrxc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�CoExtracCstd�S)Nz	lambda:42)�eval)r rrr�get_func$szCoExtra.get_funccCs<|j�}|jttdttjd��|jttdttjd��dS)N�*�d)r{�assertRaises�SystemError�SetExtra�
FREE_INDEX�ctypes�c_voidp�GetExtra)r rDrrr�test_get_non_code*s
zCoExtra.test_get_non_codecCsJ|j�}|jtt|jtdtjd��|jt	|jtdtjd��d�dS)Nr}r)
r{r~rr�r?r�r�r�r(r�)r rDrrr�test_bad_index2s
zCoExtra.test_bad_indexcCs.|j�}t|jttjd��~|jtd�dS)Nr})r{r�r?r�r�r�r(rw)r rDrrr�test_free_called9szCoExtra.test_free_calledcCsn|j�}tj�}t|jttjd��t|jttjd��|jtd�tj�}t|jt|�|j|j	d�~dS)N��i,)
r{r�r�r�r?r�r(rwr�r^)r rDZextrarrr�test_get_setBszCoExtra.test_get_setcCsZ|j�}Gdd�dtj�}t|jttjd��|||�}~|j�|j	�|j
td�dS)Ncs$eZdZ�fdd�Zdd�Z�ZS)z6CoExtra.test_free_different_thread.<locals>.ThreadTestcst�j�||_||_dS)N)r�__init__rD�test)r rDr�)r.rrr�Ws
z?CoExtra.test_free_different_thread.<locals>.ThreadTest.__init__cSs|`|jjtd�dS)Ni�)rDr�r(rw)r rrr�run[sz:CoExtra.test_free_different_thread.<locals>.ThreadTest.run)rGrHrIr�r��
__classcell__rr)r.r�
ThreadTestVsr�i�)r{�	threadingZThreadr�r?r�r�r��start�joinr(rw)r rDr�Zttrrr�test_free_different_threadRs	
z"CoExtra.test_free_different_threadN)	rGrHrIr{r�r�r�r�r�rrrrry#s	rycCsHddlm}t||�tttg}tdd�r<tdk	r<|jt	�t
|�dS)Nr)�	test_codeT)rv)r�r�rr#r\rnrr��appendryr)�verboser�Ztestsrrr�	test_mainfs


r��__main__)N)-�__doc__rRrXr�Zunittestrqr��ImportErrorZtest.supportrrrrr
rr"ZTestCaser#r[r\rnZ	pythonapi�pyZ	CFUNCTYPEr�ZfreefuncZ_PyEval_RequestCodeExtraIndexZRequestCodeExtraIndexZargtypesZ	c_ssize_tZrestypeZ_PyCode_SetExtrar�Z	py_objectZc_intZ_PyCode_GetExtrar�ZPOINTERrwrxZ	FREE_FUNCr�ryr�rGrrrr�<module>gsL
		30C



Youez - 2016 - github.com/yon3zu
LinuXploit