Your IP : 13.59.69.109


Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/fixes/__pycache__/fix_raise.cpython-312.opt-1.pyc

�

�Q�fn��r�dZddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZGd�dej�Z
y)	a[Fixer for 'raise E, V, T'

raise         -> raise
raise E       -> raise E
raise E, V    -> raise E(V)
raise E, V, T -> raise E(V).with_traceback(T)
raise E, None, T -> raise E.with_traceback(T)

raise (((E, E'), E''), E'''), V -> raise E(V)
raise "foo", V, T               -> warns about string exceptions


CAVEATS:
1) "raise E, V" will be incorrectly translated if V is an exception
   instance. The correct Python 3 idiom is

        raise E from V

   but since we can't detect instance-hood by syntax alone and since
   any client code would have to be changed as well, we don't automate
   this.
�)�pytree)�token)�
fixer_base)�Name�Call�Attr�ArgList�is_tuplec��eZdZdZdZd�Zy)�FixRaiseTzB
    raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] >
    c�v�|j}|dj�}|jtjk(rd}|j||�yt
|�rHt
|�r6|jdjdj�}t
|�r�6d|_d|vr>tj|jtd�|g�}|j|_|S|dj�}t
|�r+|jddD�cgc]}|j���}	}n
d	|_|g}	d
|vr�|d
j�}
d	|
_|}|jtjk7s|jdk7rt||	�}t!|td��t#|
g�gz}tj|j$td�g|z�}|j|_|Stj|jtd�t||	�g|j�
�Scc}w)N�excz+Python 3 does not support string exceptions��� �val�raise�����tb�None�with_traceback)�prefix)�syms�clone�typer�STRING�cannot_convertr
�childrenrr�Node�
raise_stmtr�NAME�valuerrr	�simple_stmt)
�self�node�resultsrr�msg�newr�c�argsr�e�with_tbs
             �>/opt/alt/python312/lib64/python3.12/lib2to3/fixes/fix_raise.py�	transformzFixRaise.transform&s����y�y���e�n�"�"�$���8�8�u�|�|�#�?�C�����c�*���C�=��3�-��l�l�1�o�.�.�q�1�7�7�9���3�-��C�J�����+�+�d�o�o��W�
�s�/C�D�C����C�J��J��e�n�"�"�$���C�=�'*�|�|�A�b�'9�:�'9�!�A�G�G�I�'9�D�:��C�J��5�D��7�?����$�$�&�B��B�I��A��x�x�5�:�:�%����f�)<���d�O���1�d�#3�4�5��"����G�G��+�+�d�.�.��g���'�0I�J�C����C�J��J��;�;�t��� $�W�
�t�C���?�&*�k�k�3�
3��);s�H6N)�__name__�
__module__�__qualname__�
BM_compatible�PATTERNr/��r.rrs���M��G�43r6rN)�__doc__rr�pgen2rr�
fixer_utilrrrr	r
�BaseFixrr5r6r.�<module>r;s-���2���<�<�;3�z�!�!�;3r6

?>