52
52
# exc.children[1:-1] is the unparenthesized tuple
53
53
# exc.children[1].children[0] is the first element of the tuple
54
54
exc = exc.children[1].children[0].clone()
57
57
if "val" not in results:
58
58
# One-argument raise
59
new = pytree.Node(syms.raise_stmt, [Name("raise"), exc])
60
new.set_prefix(node.get_prefix())
59
new = pytree.Node(syms.raise_stmt, [Name(u"raise"), exc])
60
new.prefix = node.prefix
63
63
val = results["val"].clone()
65
65
args = [c.clone() for c in val.children[1:-1]]
70
70
if "tb" in results:
71
71
tb = results["tb"].clone()
74
74
e = Call(exc, args)
75
with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])]
76
new = pytree.Node(syms.simple_stmt, [Name("raise")] + with_tb)
77
new.set_prefix(node.get_prefix())
75
with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])]
76
new = pytree.Node(syms.simple_stmt, [Name(u"raise")] + with_tb)
77
new.prefix = node.prefix
80
80
return pytree.Node(syms.raise_stmt,
81
[Name("raise"), Call(exc, args)],
82
prefix=node.get_prefix())
81
[Name(u"raise"), Call(exc, args)],