§
¼°�óÑÞ ~ã óp — d Z ddlmZ ddlmZ ddlmZ ddlmZmZm Z m
Z
mZ G d„ dej ¦ « Z
dS ) 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 ó — e Zd ZdZdZd„ ZdS )ÚFixRaiseTzB
raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] >
c óh — | j }|d ¦ « }|j t j k rd}| ||¦ « d S t
|¦ « rOt
|¦ « r9|j d j d ¦ « }t
|¦ « °9d|_ d|vr7t j
|j t d¦ « |g¦ « }|j |_ |S |d ¦ « }t
|¦ « rd„ |j dd … D ¦ « }n
d
|_ |g}d|v r»|d ¦ « } d
| _ |}
|j t j
k s|j dk rt ||¦ « }
t! |
t d
¦ « ¦ « t# | g¦ « gz }t j
|j t d¦ « g|z ¦ « }|j |_ |S t j
|j t d¦ « t ||¦ « g|j ¬¦ « S )NÚexcz+Python 3 does not support string exceptionsé é ú ÚvalÚraisec ó6 — g | ]}| ¦ « ‘ŒS © )Úclone)Ú.0Úcs ú>/opt/alt/python311/lib64/python3.11/lib2to3/fixes/fix_raise.pyú