Files
PowerToys/PythonHome/Lib/lib2to3/fixes/fix_raise.pyc

41 lines
2.4 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@s{dZddlmZddlmZddlmZddlmZmZm Z m
Z
m Z dej fd<00><00>YZ dS( s[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.
i(tpytree(ttoken(t
fixer_base(tNametCalltAttrtArgListtis_tupletFixRaisecBseZeZdZd<00>ZRS(sB
raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] >
c Cs |j}|dj<00>}|jtjkrEd}|j||<00>dSt|<00>r<>x*t|<00>r}|jdjdj<00>}qTWd|_nd|kr<>t j
|j t d<00>|g<00>}|j|_|S|dj<00>}t|<00>rg|jdd!D]}|j<00>^q<>} nd |_|g} d
|kr<>|d
j<00>}
d |
_|} |jtj ksm|jd krt|| <00>} nt| t d <00><00>t|
g<00>g} t j
|jt d<00>g| <17>}|j|_|St j
|j t d<00>t|| <00>gd |j<00>SdS(Ntexcs+Python 3 does not support string exceptionsiiu tvaluraisei<65><69><EFBFBD><EFBFBD>uttbuNoneuwith_tracebacktprefix(tsymstclonettypeRtSTRINGtcannot_convertRtchildrenR RtNodet
raise_stmtRtNAMEtvalueRRRt simple_stmt( tselftnodetresultsR R tmsgtnewR
tctargsR tetwith_tb((s .\Lib\lib2to3\fixes\fix_raise.pyt transform&s@    !  ,    !%"  (t__name__t
__module__tTruet BM_compatibletPATTERNR!(((s .\Lib\lib2to3\fixes\fix_raise.pyRsN(t__doc__tRtpgen2RRt
fixer_utilRRRRRtBaseFixR(((s .\Lib\lib2to3\fixes\fix_raise.pyt<module>s
(