403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/pythran/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/__pycache__/toolchain.cpython-311.pyc
�

cR�a�G���dZddlmZmZddlmZddlmZmZm	Z	m
Z
ddlmZmZm
Z
mZddlmZddlmZmZddlmZmZdd	lmZdd
lmZddlmZddlmZdd
lmZddl m!Z!m"Z"ddl m#Z#ddl$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7ddl8Z9ddl:Z:ddl;Z<ddl=Z=ddl>Z>ddl?Z?ddl@mAZAddlBZBe:jCd��ZDd�ZEd�ZFd�ZGd�ZH		d(d �ZId)d!�ZJ		d(d"�ZKd*d#�ZLd+d$�ZM			d,d%�ZN		d-d&�ZOd'�ZPdS).z�
This module contains all the stuff to make your way from python code to
a dynamic library, see __init__.py for exported interfaces.
�)�Cxx�Python)�cfg)�PythonModule�Include�Line�	Statement)�FunctionBody�FunctionDeclaration�Value�Block)�ReturnStatement)�PythranExtension�PythranBuildExt)�refine�mark_unexported_functions)�PassManager)�pythran_ward)�tog)�pytype_to_deps��pytype_to_ctype)�
load_specfile�Spec)�spec_to_string)�check_specs�
check_exports�PythranSyntaxError)�__version__)�cxxidN)�datetime)�CompileError)�	sysconfig)�setup)�mkdtemp�NamedTemporaryFile)�reduce�pythranc�X�t��}|j���D].}|D])}|D]$}|�t	|�����%�*�/|j���D])}|D]$}|�t	|�����%�*t
|d����S)zD Extract types dependencies from specs for each exported signature. c�
�d|vS)N�include�)�xs �3/usr/lib/python3/dist-packages/pythran/toolchain.py�<lambda>z-_extract_specs_dependencies.<locals>.<lambda>;s��i�q�&8��)�key)�set�	functions�values�updater�capsules�sorted)�specs�deps�
signatures�	signature�ts     r.�_extract_specs_dependenciesr=+s����5�5�D��o�,�,�.�.�/�/�
�#�	/�	/�I��
/�
/�����N�1�-�-�.�.�.�.�
/�	/�
�^�*�*�,�,�+�+�	��	+�	+�A��K�K��q�)�)�*�*�*�*�	+��$�8�8�9�9�9�9r0c���|�d��}t|��dkrddg|z}tt|dd�t	|d����S)zqTurns an optimization of the form
        my_optim
        my_package.my_optim
        into the associated symbol�.�r(�
optimizationsNr)�split�lenr'�getattr�
__import__)�optimization�splitteds  r.�_parse_optimizationrH>s]��
�!�!�#�&�&�H�
�8�}�}������/�(�:���'�8�A�B�B�<��H�Q�K�)@�)@�A�A�Ar0c��td|d���5}|�|��|jcddd��S#1swxYwYdS)z�write `content` to a temporary XXX`suffix` file and return the filename.
       It is user's responsibility to delete when done.�wF)�mode�suffix�deleteN)r&�write�name)�contentrL�outs   r.�_write_temprRIs���
��V�E�	B�	B�	B��c��	�	�'�����x���������������������s�<�A�Ac��|jD]?}t|tj��r#|j|krd�|jjD��cS�@gS)z(Checks if a given function has argumentsc�6�g|]}t|j����Sr,)r �id)�.0�args  r.�
<listcomp>z has_argument.<locals>.<listcomp>Us ��9�9�9�c�E�#�&�M�M�9�9�9r0)�body�
isinstance�ast�FunctionDefrO�args)�module�fname�ns   r.�has_argumentraQsU��
�[�:�:���a���)�)�	:�a�f��o�o�9�9�Q�V�[�9�9�9�9�9�9��
�Ir0Fc��t||��}tj||��\}}|�t||��}|�'t	jdd�����}d�|D��}t||||��|||fS)z*Front-end and middle-end compilation stepsNr(rAc�,�g|]}t|����Sr,)rH)rV�opts  r.rXz$front_middle_end.<locals>.<listcomp>hs!��G�G�G�#�(��-�-�G�G�Gr0)r�frontend�parserr�getrBr)	�module_name�coderA�
module_dir�entry_points�report_times�pm�ir�
docstringss	         r.�front_middle_endrpYs���
�[�*�	-�	-�B��^�B��-�-�N�B�
���
&�r�<�
8�
8������	�?�;�;�A�A�C�C�
�G�G��G�G�G�M�
�2�r�=�,�/�/�/�
�r�:��r0c�h�t|||||���\}}}|�t|��S)zYpython + pythran spec -> py code

    Prints and returns the optimized python code.

    )rl)rp�dumpr)rhrirArjrlrmrn�_s        r.�generate_pyrtqs7��!��d�M�:�\h�i�i�i�I�B��A�
�7�7�6�2���r0c�h
����r"t������}nd}t||||||���\}�}|�t���}	��%Gd�dt
��}
|
|	��}�fd�}�n�t
�t��rt�i�����fd�}��	|��t|����t
|t��r|}
n|�dd��}
tj|
�����t t#j��d	�}t'|||��}|�t+d
��t+d��t+d��t+d
��t-d����|jd�t/���D���|j|	j�|�t+d����d�}�j���D�]�\}}t7|��}|s3|�|d�|||������t=|��D�]J\}}d�||��}d�|D��}t?�|��}d�tA||��D��}tBdz}d�"|��}|�|||rd�|��nd��}d|z}|�#tItKtM||��d�tA||��D����tOtQd�|||��d�"|������g����|||����L����j)���D�]R\}}t7|��}d�|D��}t?�|��}d�tA||��D��}tBdz}d�"|��}|�|||rd�|��nd��}d|z}tU||��}|�+tItKtM||��d�tA||��D����tOtYd �|||��d�"|������g����||����T||fS)!z�python + pythran spec -> c++ code
    returns a PythonModule object and an error checker

    the error checker can be used to print more detailed info on the origin of
    a compile error (e.g. due to bad typing)

    N)rlrkc��eZdZd�Zd�ZeZdS)�generate_cxx.<locals>.Generablec��||_dS�N)rP)�selfrPs  r.�__init__z(generate_cxx.<locals>.Generable.__init__�s
��&����r0c�*�t|j��Sry)�strrP)rzs r.�__str__z'generate_cxx.<locals>.Generable.__str__�s���4�<�(�(�(r0N)�__name__�
__module__�__qualname__r{r~�generater,r0r.�	Generablerw�s3������
'�
'�
'�
)�
)�
)��H�H�Hr0r�c�0��tj���dSry)r�	typecheck)rns�r.�
error_checkerz#generate_cxx.<locals>.error_checker�s����M�"�����r0c�P��tj���}t�|��dSry)rr�r)�typesrnr8s ��r.r�z#generate_cxx.<locals>.error_checker�s(����M�"�%�%�E���u�%�%�%�%�%r0�ascii�ignore)�hash�version�datezpythonic/core.hppzpythonic/python/core.hppzpythonic/types/bool.hppzpythonic/types/int.hppz&#ifdef _OPENMP
#include <omp.h>
#endifc�,�g|]}t|����Sr,)r)rV�incs  r.rXz generate_cxx.<locals>.<listcomp>�s0��B�B�B�s�g�c�l�l�B�B�Br0z%pythonic/python/exception_handler.hppc�>�td�||��zS)Nz{0}::{1})r�format)rh�
internal_names  r.�wardedzgenerate_cxx.<locals>.warded�s���*�"3�"3�K��"O�"O�O�Or0z{}()()z{0}{1}c�,�g|]}t|����Sr,r�rVr<s  r.rXz generate_cxx.<locals>.<listcomp>�s ��"I�"I�"I�!�?�1�#5�#5�"I�"I�"Ir0c��g|]\}}|��Sr,r,�rVr`rss   r.rXz generate_cxx.<locals>.<listcomp>�s.��D�D�D�4�1�a�Q�D�D�Dr0z{0}::{1}::type{2}z, z<{0}>�ztypename %s::result_typec�:�g|]\}}t|dz|����S)z&&�r�rVr<�as   r.rXz generate_cxx.<locals>.<listcomp>�s@��J�J�J�!%��A�#�1�t�8�Q�/�/�J�J�Jr0a�
                            PyThreadState *_save = PyEval_SaveThread();
                            try {{
                                auto res = {0}()({1});
                                PyEval_RestoreThread(_save);
                                return res;
                            }}
                            catch(...) {{
                                PyEval_RestoreThread(_save);
                                throw;
                            }}
                            c�,�g|]}t|����Sr,rr�s  r.rXz generate_cxx.<locals>.<listcomp>s ��E�E�E�a��q�1�1�E�E�Er0c��g|]\}}|��Sr,r,r�s   r.rXz generate_cxx.<locals>.<listcomp>s.��@�@�@�t�q�!��@�@�@r0c�4�g|]\}}t||����Sr,r�r�s   r.rXz generate_cxx.<locals>.<listcomp>s:��F�F�F�!�Q���q�!���F�F�Fr0z
{0}()({1}))-r2�keysrprrr�objectrZ�dictr�
to_docstringsr�bytes�encode�hashlib�sha256�	hexdigestrr!�nowr�add_to_includesrrr=rYr3�itemsr �add_global_varr��	enumeratera�zipr�join�add_pyfunctionr
rrr
r	r6r�add_capsuler)rhrir8rArjrlrkrmrorPr��modr��
code_bytes�metainfor��
function_namer:�internal_func_name�sigidr;�numbered_function_name�arguments_types�arguments_names�	arguments�name_fmt�	args_list�specialized_fname�result_type�	docstringrns  `                           @r.�generate_cxxr�|s�����
���5�:�:�<�<�(�(�����)�+�t�]�*4�7C�7C�E�E�E��B��J��g�g�c�2���G�
�}�	�	�	�	�	��	�	�	��i�� � ��	�	�	�	�	�	��e�T�"�"�	$����O�O�E�	&�	&�	&�	&�	&�	&�	���J�'�'�'��b�"�e�$�$�$��d�E�"�"�	8��J�J����W�h�7�7�J�#�N�:�6�6�@�@�B�B�*�$�L�N�N�,�,���;�
�H�=�=������'�(�(��.�/�/��-�.�.��,�-�-��;�<�<�
	
�	
�	
�	���B�B�9�%�@�@�B�B�B�	C�	C����W�\�*�*�����;�<�<�	
�	
�	
�	P�	P�	P�*/��)>�)>�)@�)@�0	�0	�%�M�:�!&�}�!5�!5���
P��"�"�=�#+�?�?�6�6�+�:L�4N�4N�$O�$O�P�P�P�%.�j�$9�$9�(
�(
� ��y�)1���9K�9>�*@�*@�&�"I�"I�y�"I�"I�"I��".�r�=�"A�"A��D�D� ��/�B�B�D�D�D�	�'�*=�=�� �I�I�o�6�6�	�$,�O�O�K�4F�7F�5O�G�N�N�9�4M�4M�4M�LN�%P�%P�!�9�;L�L���"�"� �+�!� +� 6�8�8�J�J�),�_�i�)H�)H�J�J�J�	K�K��y�* �!'��v�v�k�.@�(B�(B�'+�y�y��';�';�!=�!=�
 >�
 >�
?�
@�
@���,"�#��3����(
�T).��(<�(<�(>�(>�	�	�$�M�9�!&�}�!5�!5��E�E�9�E�E�E�O�*�2�}�=�=�O�@�@��_�o�>�>�@�@�@�I�#�&9�9�H��	�	�/�2�2�I� (����0B�3B�1K����y�0I�0I�0I�HJ�!L�!L��5�7H�H�K�&�}�i�@�@�I��O�O��'��k�=�9�9�F�F�%(��)�%D�%D�F�F�F�G�G��?�<�+>�+>���{�,>�?�?��	�	�)�,�,�,.�,.�/�/�0�1�1�����
�
�
�
��
��r0c��t��}t��}t||gfi|��}	t||gdtidt�tj��rdnddd|d|g���n.#t$r!}tt|�����d}~wwxYwd	�}tjd
��}	tj
tj�||dz����D�]}
|
�|	��rZ|r|�d|	��}n4tj�tj��||	z��}||
|���r|r6|�dd
��}tj�|��}ntj��}||
tj�|tj�|
��������t-j|��t-j|��t�d|z��t�d|z��|S)zyc++ file -> native module
    Return the filename of the produced shared library
    Raises CompileError on failure

    �	build_extzsetup.pyz	--verbosez--quietz--build-libz--build-temp)rO�ext_modules�cmdclass�script_name�script_argsNc��t|d��5}t|d��5}|�|�����ddd��n#1swxYwYddd��dS#1swxYwYdS)N�rb�wb)�openrN�read)�src_file�	dest_file�src�dests    r.�copyzcompile_cxxfile.<locals>.copy;s���
�(�D�
!�
!�	'�S��i��&�&�
'�$��
�
�3�8�8�:�:�&�&�&�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'����
'�
'�
'�
'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	'�	's4�A.�(A�
A.�A	�A.�A	�A.�.A2�5A2�
EXT_SUFFIX�*�%{ext}r�zGenerated module: zOutput: )r%rr$r�logger�isEnabledFor�logging�INFO�
SystemExitr"r}r#�get_config_var�glob�os�pathr��endswith�replace�getcwd�dirname�basename�shutil�rmtree�info)rh�cxxfile�
output_binary�kwargs�builddir�buildtmp�	extension�er��ext�f�output_directorys            r.�compile_cxxfiler�sV���y�y�H��y�y�H� ��")��+�+�#)�+�+�I�#�
�;�$�+�#�_�5�$�$�1�1�'�,�?�?�*�;�;� )�&�(�(�)�8�5�	�	�	�	�	���#�#�#��3�q�6�6�"�"�"�����#����'�'�'��
"�<�
0�
0�C�
�Y�r�w�|�|�H�k�C�.?�@�@�
A�
A�
I�
I���:�:�c�?�?�	I��
M� -� 5� 5�h�� D� D�
�
� "����R�Y�[�[�+��:K� L� L�
��D��M�"�"�"�"��
/� -� 5� 5�h�� C� C�
�#%�7�?�?�=�#A�#A� � �#%�9�;�;� ��D��B�G�L�L�!1�2�7�3C�3C�A�3F�3F�G�G�H�H�H�H�
�M�(����
�M�(����
�K�K�$�{�2�3�3�3�
�K�K�
�]�*�+�+�+��s�AA6�6
B!�B�B!c��t|d��}t|||fi|��}|stj|��nt�d|z��|S)zZc++ code (string) -> temporary file -> native module.
    Returns the generated .so.

    �.cppz!Keeping temporary generated file:)rRr�r��remover��warning)rh�cxxcoder��	keep_tempr��fdpaths      r.�compile_cxxcoder�Zsp����&�
)�
)�F�#�K��$1�=�=�5;�=�=�M��E�
�	�&��������:�V�C�D�D�D��r0c	�F�|r}t|||||��}
|�t|
��dSt|
d��}|�d��}t	j||��t�d|z��ddlm	}|�||��}t||||||��\}
}d|	�dg��vrr|
j�
dtd����|
j�
dtd	�tjj������|rntt%|
��d
��}|r|�dd
��}n|d
z}t	j||��t�d|z��n}|st)d
���	t+|t%|
��fd|i|	��}nM#t,$r@t�d��|��t�d���wxYw|S)a Pythran code (string) -> c++ code -> native module

    if `cpponly` is set to true, return the generated C++ filename
    if `pyonly` is set to true, prints the generated Python filename,
       unless `output_file` is set
    otherwise, return the generated native library filename
    Nz.pyzGenerated Python source file: r)�spec_parser�ENABLE_PYTHON_MODULE�undef_macrosz#undef ENABLE_PYTHON_MODULEz#define PY_MAJOR_VERSION {}r�r�zGenerated C++ source file: z/Empty spec files while generating native moduler�z4Compilation error, trying hard to find its origin...z,Nop, I'm going to flood you with C++ errors!)rt�printrRr�r��mover�r��pythran.specr�r�rg�preamble�insertr�sys�version_info�majorr}r��
ValueErrorr�r"r�)rh�pythrancoder8�opts�cpponly�pyonly�output_filerjrlr�rP�tmp_filer�r^r�s               r.�compile_pythrancodernsy���
H��k�;��j�,�W�W�����'�N�N�N��4�"�7�E�2�2�H�%�,�,�U�3�3�K��K��+�.�.�.��K�K�8�;�F�G�G�G�)�(�(�(�(�(��}���K�(�(��)��k�5�$�)3�\�C�C��F�M�����N�B�!?�!?�?�?�����q�$�'D�"E�"E�F�F�F�����q�$�'D�'-�v�c�.>�.D�'E�'E�#G�#G�	H�	H�	H����s�6�{�{�F�3�3���	/�%�-�-�h��?�?�K�K�%��.�K���H�k�*�*�*����1�K�?�@�@�@�@��	P��N�O�O�O�
	�)�+�*-�f�+�+�4�4�8C�4�-3�4�4�K�K���	�	�	��N�N�?�
@�
@�
@��M�O�O�O��N�N�I�J�J�J��	�����s
�6G�A
Hc
�<�|sJtj�|��\}}|p$tj�|��d}nTtj�|�dd����\}}|p|�dd��d}tj�|��}	tj�|��ddz}
tj�|
��r%t|
��}|�d|��	t|��5}t||���f||||	|d�|��}d	d	d	��n#1swxYwYn!#t$r}
|
j
�||
_
�d	}
~
wwxYw|S)
a�
    Pythran file -> c++ file -> native module.

    Returns the generated .so (or .cpp if `cpponly` is set to true).

    Usage without an existing spec file

    >>> with open('pythran_test.py', 'w') as fd:
    ...    _ = fd.write('def foo(i): return i ** 2')
    >>> cpp_path = compile_pythranfile('pythran_test.py', cpponly=True)

    Usage with an existing spec file:

    >>> with open('pythran_test.pythran', 'w') as fd:
    ...    _ = fd.write('export foo(int)')
    >>> so_path = compile_pythranfile('pythran_test.py')

    Specify the output file:

    >>> import sysconfig
    >>> ext = sysconfig.get_config_vars()["SO"]
    >>> so_path = compile_pythranfile('pythran_test.py', output_file='foo'+ext)
    rr�r�r?r@z.pythranr8)r
rr	rjrlN)r�r�rB�splitextr�r��isfiler�
setdefaultr�rr�r�filename)�	file_pathr
rhrr	rlr�rsr�rj�	spec_filer8�fdr�s              r.�compile_pythranfiler�s���2�?��g�m�m�I�.�.���8�!�B�R�W�%5�%5�h�%?�%?��%B����g�m�m�K�$7�$7��"�$E�$E�F�F���8�!�>�X�^�^�C��%;�%;�A�%>�������+�+�J��� � ��+�+�A�.��;�I�	�w�~�~�i� � �*��i�(�(�����'�5�)�)�)��
�)�_�_�	8��-�k�2�7�7�9�9�8�:E�6=�f�9C�;G�	8�8�
17�8�8�K�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8��������:��"�A�J�
���������
�s<�-E;�<'E/�#E;�/E3�3E;�6E3�7E;�;
F�F�Fc�\�d}td|��}|otj|��dSdS)zMSimple passthrough compile test.
    May raises CompileError Exception.

    z*
        #include <pythonic/core.hpp>
    �testN)r�r�r�)rir
s  r.�test_compiler�s>��
�D�"�&�$�/�/�K��*�B�I�k�*�*�*�*�*�*�*�*r0)NNNF)NNFry)NF)NNFFNNF)NNFFF)Q�__doc__�pythran.backendrr�pythran.configr�pythran.cxxgenrrrr	r
rrr
r�pythran.distrr�pythran.middlendrr�pythran.passmanagerr�pythran.tablesr�
pythran.typesr�pythran.types.type_dependenciesr�pythran.types.conversionrr�rrr�pythran.syntaxrrr�pythran.versionr�
pythran.utilsr �pythran.frontendrer!�distutils.errorsr"�	distutilsr#�numpy.distutils.corer$�tempfiler%r&�gastr[r��os.pathr�r�r�r��	functoolsr'r�	getLoggerr�r=rHrRrarprtr�r�r�rrrr,r0r.�<module>r0sw����
(�'�'�'�'�'�'�'�������A�A�A�A�A�A�A�A�A�A�A�A�J�J�J�J�J�J�J�J�J�J�J�J�*�*�*�*�*�*�:�:�:�:�:�:�:�:�>�>�>�>�>�>�>�>�+�+�+�+�+�+�'�'�'�'�'�'�������:�:�:�:�:�:�4�4�4�4�4�4�,�,�,�,�,�,�,�,�'�'�'�'�'�'�I�I�I�I�I�I�I�I�I�I�'�'�'�'�'�'�������#�#�#�#�#�#�������)�)�)�)�)�)�������&�&�&�&�&�&�0�0�0�0�0�0�0�0�������������
�
�
�
���������������
�
�
�
�	��	�9�	%�	%��:�:�:�&B�B�B�������HL�7<�����0����?C�/4�^�^�^�^�B:�:�:�:�z����(9=�9>�HM�?�?�?�?�DBF�BG�8�8�8�8�v
+�
+�
+�
+�
+r0

Youez - 2016 - github.com/yon3zu
LinuXploit