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 :  /usr/lib/python3/dist-packages/pythran/analyses/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

cR�aHk��f�dZddlmZddlmZmZmZddlmZddl	m
Z
mZmZddl
mZddlmZddlmZdd	lmZddlZdd
lmZddlmZddlZe��ZGd�d
e��Z Gd�de!��Z"d�Z#ej$��D]
Z%e#e%���Gd�de��Z&Gd�de&��Z'dS)z' Aliases gather aliasing informations. �)�GlobalDeclarations)�	Intrinsic�Class�UnboundValue)�ModuleAnalysis)�	functions�methods�MODULES)�Unparser)�demangleN)�isnum��deepcopy)�productc��eZdZdS)�UnboundIdentifierErrorN)�__name__�
__module__�__qualname__���:/usr/lib/python3/dist-packages/pythran/analyses/aliases.pyrrs�������Drrc�J��eZdZdZed��ZdZiZ�fd�Zefd�Z	�xZ
S)�ContainerOfz�
    Represents a container of something

    We just know that if indexed by the integer value `index',
    we get `containee'
    �nan��index�	containeec���t|��t|�����f}|tjvr7t	t|���|��}|tj|<tj|S�N)�tuple�itemsr�cache�super�__new__)�cls�args�kwargs�key�new_obj�	__class__s     �rr%zContainerOf.__new__%sk����D�k�k�5������0�0�0���k�'�'�'��K��-�-�5�5�c�:�:�G�%,�K��c�"�� ��%�%rc�"�||_||_dSr r)�selfrrs   r�__init__zContainerOf.__init__.s����
�"����r)rrr�__doc__�float�UnknownIndex�	__slots__r#r%r.�
__classcell__�r+s@rrrst����������5��<�<�L�$�I��E�&�&�&�&�&�)5�#�#�#�#�#�#�#�#rrc��|���D]h}t|t��rt|���'t	|f��t
|<t|t��rt|j���idS)z: Recursively save default aliases for pythonic functions. N)�values�
isinstance�dict�save_intrinsic_alias�	frozenset�IntrinsicAliasesr�fields)�module�vs  rr9r93s|��
�]�]�_�_�/�/���a����	/� ��#�#�#�#�"+�Q�D�/�/��Q���!�U�#�#�
/�$�Q�X�.�.�.��
/�/rc���eZdZdZdZ�fd�Zedd���Zd�Zed���Z	dd�Z
d	�Zd
�ZeZ
eZd�Zd�Zd
�Zd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�ZeZd�Zd�ZeZeZd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&�xZ'S) �Aliasesz�
    Gather aliasing informations across nodes

    As a result, each node from the module is associated to a set of node or
    Intrinsic to which it *may* alias to.
    �@c����t��|_d|_tj���t
t|���t��dSr )
r8�result�aliasesrr#�clearr$r@r.r)r-r+s �rr.zAliases.__init__LsO����f�f����������!�!�!�
�g�t���%�%�&8�9�9�9�9�9rNc��d�}t|t��ru|���D]^\}}|�t||��rGtd�||��tt
||���������_dSt|ttf��r,ttt
||������dSdS)Nc��tj��}t||��|������Sr )�io�StringIOr�getvalue�strip)�n�outputs  r�ppzAliases.dump.<locals>.ppTs9���[�]�]�F��Q������?�?�$�$�*�*�,�,�,rz{} => {})	r7r8r"�print�format�sorted�mapr:�set)rC�filterrN�kr>s     r�dumpzAliases.dumpRs���	-�	-�	-�
�f�d�#�#�	+������
H�
H���1��N�z�!�V�'<�'<�N��*�+�+�B�B�q�E�E�6�#�b�!�*�*�3E�3E�F�F�G�G�G��
H�
H����C� 0�
1�
1�	+��&��R����)�)�*�*�*�*�*�	+�	+rc��thSr )r�r-s r�get_unbound_value_setzAliases.get_unbound_value_set`s
���~�rc���t|tj��r,tjt|j��|j��St|tj��rgt|j��}t�
|j��}||vr(td�
|��|j���||St|tj��r|jS|S)Nz*Unsupported attribute '{}' for this object)r7�ast�Namer
�getr�id�	Attribute�attrr@�access_path�value�PythranSyntaxErrorrP�FunctionDef�name)�node�attr_key�
value_dicts   rrazAliases.access_pathcs����d�C�H�%�%�	��;�x���0�0�$�'�:�:�:�
��c�m�
,�
,�	���	�*�*�H� �,�,�T�Z�8�8�J��z�)�)�(�@��V�H�%�%��J� � � ��h�'�'�
��c�o�
.�
.�	��9���Krc�x�|�-t|t��r|h}n|���}||j|<|Sr )r7rrYrC)r-rfr6s   r�addzAliases.addvsD���>��$�	�*�*�
6������3�3�5�5��"���D���
rc�j����|tj�fd�|jD�����S)af
        Resulting node may alias to either operands:

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b): return a or b')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.BoolOp)
        (a or b) => ['a', 'b']

        Note that a literal does not create any alias

        >>> module = ast.parse('def foo(a, b): return a or 0')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.BoolOp)
        (a or 0) => ['<unbound-value>', 'a']
        c�:��g|]}��|����Sr��visit��.0rLr-s  �r�
<listcomp>z(Aliases.visit_BoolOp.<locals>.<listcomp>�s#���)M�)M�)M�A�$�*�*�Q�-�-�)M�)M�)Mr)rjrS�unionr6�r-rfs` r�visit_BoolOpzAliases.visit_BoolOps7���$�x�x��c�i�)M�)M�)M�)M���)M�)M�)M�N�O�O�Orc�V�|�|��|�|��S)a[
        Resulting node does not alias to anything

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a): return -a')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.UnaryOp)
        (- a) => ['<unbound-value>']
        )�
generic_visitrjrss  r�
visit_UnaryOpzAliases.visit_UnaryOp�s(��	
���4� � � ��x�x��~�~�rc�����|j���fd�|j|jfD��}��|tj|���S)ag
        Resulting node alias to either branch

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b, c): return a if c else b')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.IfExp)
        (a if c else b) => ['a', 'b']
        c�:��g|]}��|����Srrmros  �rrqz'Aliases.visit_IfExp.<locals>.<listcomp>�s#���?�?�?��t�z�z�!�}�}�?�?�?r)rn�test�body�orelserjrSrr)r-rf�recs`  r�visit_IfExpzAliases.visit_IfExp�sU���	
�
�
�4�9����?�?�?�?�t�y�$�+�&>�?�?�?���x�x��c�i��o�.�.�.rc�B�|jr�t��}t|j|j��D]W\}}|�|��|�|��}|�t
t|�����Xnd}|�||��S)a�
        A dict is abstracted as an unordered container of its values

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b): return {0: a, 1: b}')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Dict)
        {0: a, 1: b} => ['|a|', '|b|']

        where the |id| notation means something that may contain ``id``.
        N)	�keysrS�zipr6rn�updaterRrrj)r-rf�elts_aliasesr)�val�elt_aliasess      r�
visit_DictzAliases.visit_Dict�s����9�	 ��5�5�L���	�4�;�7�7�
C�
C���S��
�
�3����"�j�j��o�o���#�#�C��[�$A�$A�B�B�B�B�
C�
 �L��x�x��l�+�+�+rc�j��|jr�fd�|jD��}nd}��||��S)a�
        A set is abstracted as an unordered container of its elements

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b): return {a, b}')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Set)
        {a, b} => ['|a|', '|b|']

        where the |id| notation means something that may contain ``id``.
        c�^��h|])}��|��D]}t|�����*Sr)rnr)rp�elt�aliasr-s   �r�	<setcomp>z$Aliases.visit_Set.<locals>.<setcomp>�sP���:�:�:� #�)-���C���:�:� %�(��.�.�:�:�:�:rN)�eltsrj)r-rfr�s`  r�	visit_SetzAliases.visit_Set�sV����9�	 �:�:�:�:�'+�y�:�:�:�L�L� �L��x�x��l�+�+�+rc���|jsdS|�|j��}tj|jvr*|�|jtj��}||jtj<dS)a#
        A side effect of computing aliases on a Return is that it updates the
        ``return_alias`` field of current function

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b): return a')
        >>> result = pm.gather(Aliases, module)
        >>> module.body[0].return_alias # doctest: +ELLIPSIS
        <function ...merge_return_aliases at...>

        This field is a function that takes as many nodes as the function
        argument count as input and returns an expression based on
        these arguments if the function happens to create aliasing
        between its input and output. In our case:

        >>> f = module.body[0].return_alias
        >>> Aliases.dump(f([ast.Name('A', ast.Load(), None, None),
        ...                 ast.Constant(1, None)]))
        ['A']

        This also works if the relationship between input and output
        is more complex:

        >>> module = ast.parse('def foo(a, b): return a or b[0]')
        >>> result = pm.gather(Aliases, module)
        >>> f = module.body[0].return_alias
        >>> List = ast.List([ast.Name('L0', ast.Load(), None, None)],
        ...                 ast.Load())
        >>> Aliases.dump(f([ast.Name('B', ast.Load(), None, None), List]))
        ['B', '[L0][0]']

        Which actually means that when called with two arguments ``B`` and
        the single-element list ``[L[0]]``, ``foo`` may returns either the
        first argument, or the first element of the second argument.
        N)rbrnr@�RetIdrDrr)r-rf�ret_aliasess   r�visit_ReturnzAliases.visit_Return�sf��J�z�	��F��j�j���,�,���=�D�L�(�(�%�+�+�D�L���,G�H�H�K�&1���W�]�#�#�#rc�V�����fd�}d���fd�}|j}t��}|jrn�t|tj��rWt
j|jtj|jdg��d��\}}|r|||��}|||��}nht|tj
��rN�j|}	|	D]>}
t|
d��r,||
|��}|�
||
|�����>�?�fd�|D��|p����S)Nc����fd�|D��}t��}t|�D]*}|�|�|�����+�fd�|D��S)Nc�0��g|]}�j|p|h��Sr)rC)rp�argr-s  �rrqzNAliases.call_return_alias.<locals>.interprocedural_aliases.<locals>.<listcomp>s'���E�E�E��4�;�s�+�4��u�E�E�Erc�&��h|]
}�|����Srr)rp�ra�expand_subscripts  �rr�zMAliases.call_return_alias.<locals>.interprocedural_aliases.<locals>.<setcomp>s%���B�B�B�R�$�$�R�(�(�B�B�Br)rSrr��return_alias)�funcr'�arg_aliases�return_aliases�args_combinationr�r-s     ��r�interprocedural_aliasesz:Aliases.call_return_alias.<locals>.interprocedural_aliases
s����E�E�E�E��E�E�E�K� �U�U�N�$+�[�$9�
9�
9� ��%�%��%�%�&6�7�7�9�9�9�9�B�B�B�B�>�B�B�B�Brc��t|tj��r&t|jt��r|jjS|Sr )r7r[�	Subscriptrbrr)rfs rr�z3Aliases.call_return_alias.<locals>.expand_subscripts:���$��
�.�.�
0��d�j�+�6�6�0��:�/�/��Krc���|j}t|tj��rht	|jj��t	|��z
}|r=d�|jj|d�D��}|D]}��|���||z}|S)Nc�,�g|]}t|����Srr)rprLs  rrqz@Aliases.call_return_alias.<locals>.full_args.<locals>.<listcomp> s��L�L�L�A�H�Q�K�K�L�L�Lr)r'r7r[rd�len�defaultsrn)r��callr'�extra�tailr�r-s      �r�	full_argsz,Aliases.call_return_alias.<locals>.full_argss�����9�D��$���0�0�
'��D�I�N�+�+�c�$�i�i�7���'�L�L���1C�E�F�F�1K�L�L�L�D�#�(�(���
�
�3������$�;�D��Kr)NNrr�c�L��g|] }|�jv���|����!Sr)rCrj)rp�ar-s  �rrqz-Aliases.call_return_alias.<locals>.<listcomp><s/���>�>�>���$�+�)=�)=����!���)=�)=�)=r)r�rS�keywordsr7r[r_r	r]r`rr\rC�hasattrr�rY)r-rfr�r�r�rD�_�	signaturer'�func_aliases�
func_aliasr�s`          @r�call_return_aliaszAliases.call_return_aliass�����	C�	C�	C�	C�	C�	C�	�	�	�		�		�		�		�		��y���%�%���=�	��
��c�m�
,�
,�	�"�;�t�y�'0�}�T�Y�6B�^�(E�(E�EF�(H�I�I�L�A�y��
C� �y��D�1�1��1�1�)�T�B�B���
��c�h�
'�
'�	��;�t�,�L�*�
�
�
��:�~�6�6��$�9�Z��6�6�D��N�N�#:�#:�:�t�#L�#L�M�M�M�M��>�>�>�>�g�>�>�>�>��6�$�4�4�6�6�6rc���|�|��|j}t|tj��r"|jdkr|�||h��S|�|��}t��}|D]�}t|ttj
tf��r|�|���?||jvr!|�
|j|���i	t�|��}|�
|j�|d������#t$$r|�|��Y��wxYw|�||��S)a�
        Resulting node alias to the return_alias of called function,
        if the function is already known by Pythran (i.e. it's an Intrinsic)
        or if Pythran already computed it's ``return_alias`` behavior.

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> fun = """
        ... def f(a): return a
        ... def foo(b): c = f(b)"""
        >>> module = ast.parse(fun)

        The ``f`` function create aliasing between
        the returned value and its first argument.

        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Call)
        f(b) => ['b']

        This also works with intrinsics, e.g ``dict.setdefault`` which
        may create alias between its third argument and the return value.

        >>> fun = 'def foo(a, d): builtins.dict.setdefault(d, 0, a)'
        >>> module = ast.parse(fun)
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Call)
        builtins.dict.setdefault(d, 0, a) => ['<unbound-value>', 'a']

        Note that complex cases can arise, when one of the formal parameter
        is already known to alias to various values:

        >>> fun = """
        ... def f(a, b): return a and b
        ... def foo(A, B, C, D): return f(A or B, C or D)"""
        >>> module = ast.parse(fun)
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Call)
        f((A or B), (C or D)) => ['A', 'B', 'C', 'D']
        �partialr)rvr�r7r[r_r`rjr�rSrrdrrCr�r@rarDr]�NotImplementedError)r-rf�fr��all_aliasesrb�aps       r�
visit_CallzAliases.visit_Call?sm��P	
���4� � � ��I���a���'�'�	/�A�F�i�,?�,?��8�8�D�4�&�)�)�)��1�1�$�7�7�L��%�%�K�%�

/�

/���e�k�3�?�&/�&1�2�2�/��O�O�E�*�*�*�*��d�k�)�)��&�&�t�{�5�'9�:�:�:�:�/�$�0�0��7�7��#�*�*�4�<�+;�+;�B��+C�+C�D�D�D�D��.�/�/�/�#����.�.�.�.�.�/�����8�8�D�+�.�.�.s�(AD1�1E�Ec�`�|�|t�|��h��Sr )rjr@rarss  r�visit_AttributezAliases.visit_Attribute�s'���x�x��w�2�2�4�8�8�9�:�:�:rc�J�t|jtj��rB|�|j��|jjD]}|�|���d}�n-t��}|�|j��|�|j��}|D]�}t|t��ret|jtj	��r�7t|j��r|jj|jkr�a|�|j
���|tt|dd��tjtjf��r3|�tj||j|j������|sd}|�||��S)a�
        Resulting node alias stores the subscript relationship if we don't know
        anything about the subscripted node.

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a): return a[0]')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Subscript)
        a[0] => ['a[0]']

        If we know something about the container, e.g. in case of a list, we
        can use this information to get more accurate informations:

        >>> module = ast.parse('def foo(a, b, c): return [a, b][c]')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Subscript)
        [a, b][c] => ['a', 'b']

        Moreover, in case of a tuple indexed by a constant value, we can
        further refine the aliasing information:

        >>> fun = """
        ... def f(a, b): return a, b
        ... def foo(a, b): return f(a, b)[0]"""
        >>> module = ast.parse(fun)
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Subscript)
        f(a, b)[0] => ['a']

        Nothing is done for slices, even if the indices are known :-/

        >>> module = ast.parse('def foo(a, b, c): return [a, b, c][1:]')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Subscript)
        [a, b, c][1:] => ['<unbound-value>']
        N�ctx)r7�slicer[�Tuplernrbr�rSr�Slicer
rrjr�getattr�Param�Storer�r�)r-rfr�rD�
value_aliasesr�s      r�visit_SubscriptzAliases.visit_Subscript�s}��L�d�j�#�)�,�,�	��J�J�t�z�"�"�"��z��
 �
 ���
�
�3������G�G��e�e�G��J�J�t�z�"�"�"� �J�J�t�z�2�2�M�&�
L�
L���e�[�1�1�
L�!�$�*�c�i�8�8�!� ��T�Z�(�(�%��:�+�u�{�:�:�$��K�K���0�0�0�0����u�d� ;� ;�c�i�>A�i�>I�J�J�L��K�K��
�e�T�Z��� J� J�K�K�K���
����x�x��g�&�&�&rc�D�|jD]}|�|���dS)zO
        omp directive may introduce new variables, just register them
        N)�depsrj)r-rf�deps   r�visit_OMPDirectivezAliases.visit_OMPDirective�s0���9�	�	�C��H�H�S�M�M�M�M�	�	rc�x�|j|jvrt�|�||j|j��Sr )r^rDrrjrss  r�
visit_NamezAliases.visit_Name�s4���7�$�,�&�&�(�(��x�x��d�l�4�7�3�4�4�4rc���|jr_t��}t|j��D];\�}|�|��}|��fd�|D�����<nd}|�||��S)a�
        A tuple is abstracted as an ordered container of its values

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b): return a, b')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Tuple)
        (a, b) => ['|[0]=a|', '|[1]=b|']

        where the |[i]=id| notation means something that
        may contain ``id`` at index ``i``.
        c3�8�K�|]}t|���V��dSr �r)rpr��is  �r�	<genexpr>z&Aliases.visit_Tuple.<locals>.<genexpr>�sA�����$>�$>�(-�%0��q�$9�$9�$>�$>�$>�$>�$>�$>rN)r�rS�	enumeraternr�rj)r-rfr�r�r�r�s     @r�visit_TuplezAliases.visit_Tuple�s�����9�	 ��5�5�L�#�D�I�.�.�
>�
>���3�"�j�j��o�o���#�#�$>�$>�$>�$>�1<�$>�$>�$>�>�>�>�>�
>�
 �L��x�x��l�+�+�+rc�d�|jh|j|jj<|�|��dSr )�targetrDr^rvrss  r�visit_comprehensionzAliases.visit_comprehension�s0��(,��}���T�[�^�$����4� � � � � rc��|jD]}|�|���|�|j��|�|��S)aw
        A comprehension is not abstracted in any way

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b): return [a for i in b]')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.ListComp)
        [a for i in b] => ['<unbound-value>']
        )�
generatorsr�rnr�rj�r-rf�	generators   r�visit_ListCompzAliases.visit_ListComp�sP����	0�	0�I��$�$�Y�/�/�/�/��
�
�4�8�����x�x��~�~�rc���|jD]}|�|���|�|j��|�|j��|�|��S)a}
        A comprehension is not abstracted in any way

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a, b): return {i: i for i in b}')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.DictComp)
        {i: i for i in b} => ['<unbound-value>']
        )r�r�rnr)rbrjr�s   r�visit_DictCompzAliases.visit_DictCompsd����	0�	0�I��$�$�Y�/�/�/�/��
�
�4�8�����
�
�4�:�����x�x��~�~�rc�������t����_�j�d��j���D�����j�d��jjD���������tj	�jvr8���fd���fd��jtj	D����fd�}|�_
dSdS)z�
        Initialise aliasing default value before visiting.

        Add aliasing values for :
            - Pythonic
            - globals declarations
            - current function arguments
        c3�&K�|]\}}||hfV��
dSr r)rprUr>s   rr�z,Aliases.visit_FunctionDef.<locals>.<genexpr>!sH����J�J� $��1����H�J�J�J�J�J�Jrc3�*K�|]}|j|hfV��dSr )r^)rpr�s  rr�z,Aliases.visit_FunctionDef.<locals>.<genexpr>$s>����7�7� #�!�V�c�U�O�7�7�7�7�7�7rc���������t�tjttjf��r�fd�St�t
��r��j����j���fd�St�tj��r=	�j	j	�������fd�}|S#t$r�	fd�cYSwxYwt�tj��r&��j�����j
�����fd�S�	fd�S)Nc�
���hSr r)r��exps �r�<lambda>z@Aliases.visit_FunctionDef.<locals>.parametrize.<locals>.<lambda>-s	���c�U�rc�2���fd��|��D��S)Nc�0��h|]}t|�����Srr�)rp�pcrs  �rr�zSAliases.visit_FunctionDef.<locals>.parametrize.<locals>.<lambda>.<locals>.<setcomp>1s3���)�)�)��$�B��.�.�)�)�)rr)r'r�
pcontainees ��rr�z@Aliases.visit_FunctionDef.<locals>.parametrize.<locals>.<lambda>1s5���)�)�)�)�",�*�T�"2�"2�)�)�)�rc����t|��kr	|�hS�jj�t|��z
hSr )r�r'r�)r'rf�ws ��rr�zDAliases.visit_FunctionDef.<locals>.parametrize.<locals>.return_alias9s;��� �3�t�9�9�}�}�(,�Q��y� 0�(,�	�(:�1�s�4�y�y�=�(I�'J� Jrc�,������Sr �rY�r�r-s �rr�z@Aliases.visit_FunctionDef.<locals>.parametrize.<locals>.<lambda>@s����)C�)C�)E�)E�rc�6�����fd�����D��S)Nc	�z��h|]7}����D])}tj||tj������*�8Sr)r[r��Load)rprbr�r'�slicess   ��rr�zSAliases.visit_FunctionDef.<locals>.parametrize.<locals>.<lambda>.<locals>.<setcomp>Ds\���)3�)3�)3�!�%+�V�D�\�\�)3�)3�"��
�e�U�C�H�J�J�?�?�)3�)3�)3�)3rr)r'r�r6s`��rr�z@Aliases.visit_FunctionDef.<locals>.parametrize.<locals>.<lambda>Ds9����)3�)3�)3�)3�)3�%+�V�D�\�\�)3�)3�)3�rc�,������Sr r�r�s �rr�z@Aliases.visit_FunctionDef.<locals>.parametrize.<locals>.<lambda>Is���T�%?�%?�%A�%A�r)r7r[�Constantrrdrrrr\r'�
ValueErrorr�rbr�)
r�r�rr�r�r6r�rf�parametrizer-s
` @@@@@���rr�z.Aliases.visit_FunctionDef.<locals>.parametrize*sw����������c�C�L�)�S�_�#M�N�N�B�*�?�?�?�*���[�1�1�B�!,��S�]�!;�!;�J��I�E������� ��S�X�.�.�B�
F� �I�N�0�0��5�5��K�K�K�K�K�K�
 ,�+��%�F�F�F�E�E�E�E�E�E�E�F������S�]�3�3�B�(�[���3�3�F�(�[���3�3�F�3�3�3�3�3�3�
B�A�A�A�As�&B-�-B?�>B?c�&��g|]
}�|����Srr)rp�	ret_aliasr�s  �rrqz-Aliases.visit_FunctionDef.<locals>.<listcomp>Ps3���>�>�>�"+�*�k�)�4�4�>�>�>rc�"����fd��D��S)Nc�0��h|]}|���D]}|���Srr)rpr�r�r's   �rr�zJAliases.visit_FunctionDef.<locals>.merge_return_aliases.<locals>.<setcomp>UsH���6�6�6�(�".�,�t�"4�"4�6�6���6�6�6�6rr)r'r�s`�r�merge_return_aliasesz7Aliases.visit_FunctionDef.<locals>.merge_return_aliasesTs/����6�6�6�6�,:�6�6�6�6rN)r;�copyrDr��global_declarationsr"r'rvr@r�r�)r-rfr�r�r�s`` @@r�visit_FunctionDefzAliases.visit_FunctionDefsW������(�,�,�.�.�������J�J�(,�(@�(F�(F�(H�(H�J�J�J�	J�	J�	J�	
����7�7�'+�y�~�7�7�7�	7�	7�	7�	
���4� � � ��=�D�L�(�(�
B�
B�
B�
B�
B�
B�
B�L>�>�>�>�!%��g�m�!<�>�>�>�N�
6�
6�
6�
6�
6�
!5�D����c)�(rc��tj||��|�|j��}|jD]�}t	|t
j��r�t|��p|h|j|j	<t|��D]L}t	|t
j��r0|j	}|j|�|f��|j|<�M|�||j|j	����|�|����dS)a�
        Assignment creates aliasing between lhs and rhs

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse('def foo(a): c = a ; d = e = c ; {c, d, e}')
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Set)
        {c, d, e} => ['|a|']

        Everyone points to the formal parameter 'a' \o/
        N)
�mdrnrb�targetsr7r[r\rSrDr^�listrrrj)r-rfr��tr��a_ids      r�visit_AssignzAliases.visit_Assign[s���	���t�����
�
�4�:�.�.�
���		�		�A��!�S�X�&�&�
�%(��%7�%7�%>�A�3���Q�T�"�!�-�0�0�L�L�E�!�%���2�2�L�$�x��-1�\�$�-?�-E�-E�q�d�-K�-K���T�*������D�L���.�/�/�/�/��
�
�1�
�
�
�
�		�		rc�h�|�|j��}td�|D����r
d�|D��}n|jh}|�|j|��|j|j|j|jj<|�|��|�|��dS)a�
        For loop creates aliasing between the target
        and the content of the iterator

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> module = ast.parse("""
        ... def foo(a):
        ...     for i in a:
        ...         {i}""")
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Set)
        {i} => ['|i|']

        Not very useful, unless we know something about the iterated container

        >>> module = ast.parse("""
        ... def foo(a, b):
        ...     for i in [a, b]:
        ...         {i}""")
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Set)
        {i} => ['|a|', '|b|']
        c3�@K�|]}t|t��V��dSr )r7r)rp�xs  rr�z$Aliases.visit_For.<locals>.<genexpr>�s,����@�@�a�z�!�[�)�)�@�@�@�@�@�@rc��h|]	}|j��
Sr)r)rp�
iter_aliass  rr�z$Aliases.visit_For.<locals>.<setcomp>�s'��,�,�,�z�j�2�,�,�,rN)	rn�iter�allr�rjrCrDr^rv)r-rf�iter_aliases�target_aliasess    r�	visit_ForzAliases.visit_Forus���4�z�z�$�)�,�,���@�@�<�@�@�@�@�@�	+�,�,�*�,�,�,�N�N�#�k�]�N������n�-�-�-�'+�{�4�;�'?���T�[�^�$����4� � � ����4� � � � � rc�Z�|�|��|�|��dS)aD

        While statement evaluation is somehow equivalent to the evaluation of a
        sequence, except the fact that in some subtle cases, the first rounds
        of analyse fails because we do not follow the regular execution order

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> fun = """
        ... def foo(a):
        ...     while(a):
        ...         if a == 1: builtins.print(b)
        ...         else: b = a"""
        >>> module = ast.parse(fun)
        >>> result = pm.gather(Aliases, module)
        N)rvrss  r�visit_WhilezAliases.visit_While�s2��"	
���4� � � ����4� � � � � rc�Z�tj||��|�|j��dx}}	|j���}|jD]}|�|���|j}||_n#t$rYnwxYw	|jD]}|�|���|j}n#t$rYnwxYw|r/|s-||_|jD]}|�|���|j}|r/|s-||_|jD]}|�|���|j}|rx|rv|���D]_\}}||jvr)|j|�	|��|j|<�7t|ttf��sJ�||j|<�`dS|r	||_dSdS)a
        After an if statement, the values from both branches are merged,
        potentially creating more aliasing:

        >>> from pythran import passmanager
        >>> pm = passmanager.PassManager('demo')
        >>> fun = """
        ... def foo(a, b):
        ...     if a: c=a
        ...     else: c=b
        ...     return {c}"""
        >>> module = ast.parse(fun)
        >>> result = pm.gather(Aliases, module)
        >>> Aliases.dump(result, filter=ast.Set)
        {c} => ['|a|', '|b|']
        N)
r�rnrzrDr�r{rr|r"rrr7r:rS)r-rf�true_aliases�
false_aliases�tmp�stmtrUr>s        r�visit_IfzAliases.visit_If�s-��$	���t�����
�
�4�9����'+�+��}�	��,�#�#�%�%�C��	�
!�
!���
�
�4� � � � ��<�L��D�L�L��%�	�	�	��D�	����	���
!�
!���
�
�4� � � � � �L�M�M��%�	�	�	��D�	�����	)�
�	)�'�D�L���
!�
!���
�
�4� � � � � �L�M��	(��	(�(�D�L��	�
!�
!���
�
�4� � � � ��<�L��	(�\�	(�$�*�*�,�,�
(�
(���1����$�$�&*�l�1�o�&;�&;�A�&>�&>�D�L��O�O�%�a�)�S�)9�:�:�:�:�:�&'�D�L��O�O�
(�
(��	(�'�D�L�L�L�	(�	(s$�AA<�<
B	�B	�
&B4�4
C�Cc�r�|jr|jh|j|jj<|�|��dSr )rerDr^rvrss  r�visit_ExceptHandlerzAliases.visit_ExceptHandler�s:���9�	5�*.�)��D�L����&����4� � � � � rr )(rrrr/r�r.�staticmethodrVrYrarjrtrw�visit_BinOp�
visit_Comparer~r�r�r�r�r��visit_Constantr�r�r�r�r��
visit_Listr�r��
visit_SetComp�visit_GeneratorExpr�r�rrrrrr3r4s@rr@r@Bs%���������
�E�:�:�:�:�:��+�+�+��\�+��������\��$����P�P�P�(��� �K�!�M�
/�
/�
/�,�,�,�.,�,�,�**2�*2�*2�X27�27�27�h?/�?/�?/�B#�N�;�;�;�>'�>'�>'�@���5�5�5�
,�,�,�0�J�!�!�!���� #�M�'�����&C5�C5�C5�J���4%!�%!�%!�N!�!�!�(=(�=(�=(�~!�!�!�!�!�!�!rr@c��eZdZdZd�ZdS)�
StrictAliaseszW
    Gather aliasing informations across nodes,
    without adding unsure aliases.
    c��t��Sr )rSrXs rrYz#StrictAliases.get_unbound_value_set�s���u�u�rN)rrrr/rYrrrrr�s-��������
����rr)(r/�$pythran.analyses.global_declarationsr�pythran.intrinsicrrr�pythran.passmanagerr�pythran.tablesrr	r
�pythran.unparser�pythran.conversionr�pythran.metadata�metadatar��
pythran.utilsr
�gastr[r�r�	itertoolsrrHr8r;�RuntimeErrorr�objectrr9r6r=r@rrrr�<module>r.s���-�-�C�C�C�C�C�C�<�<�<�<�<�<�<�<�<�<�.�.�.�.�.�.�6�6�6�6�6�6�6�6�6�6�$�$�$�$�$�$�'�'�'�'�'�'�����������������������������	�	�	�	��4�6�6��	�	�	�	�	�\�	�	�	�#�#�#�#�#�&�#�#�#�6/�/�/��g�n���!�!�F���� � � � �p
!�p
!�p
!�p
!�p
!�n�p
!�p
!�p
!�f�����G�����r

Youez - 2016 - github.com/yon3zu
LinuXploit