~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/lib2to3/fixes/fix_throw.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
            return
33
33
 
34
34
        # Leave "g.throw(E)" alone
35
 
        val = results.get("val")
 
35
        val = results.get(u"val")
36
36
        if val is None:
37
37
            return
38
38
 
40
40
        if is_tuple(val):
41
41
            args = [c.clone() for c in val.children[1:-1]]
42
42
        else:
43
 
            val.set_prefix("")
 
43
            val.prefix = u""
44
44
            args = [val]
45
45
 
46
46
        throw_args = results["args"]
47
47
 
48
48
        if "tb" in results:
49
49
            tb = results["tb"].clone()
50
 
            tb.set_prefix("")
 
50
            tb.prefix = u""
51
51
 
52
52
            e = Call(exc, args)
53
 
            with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])]
 
53
            with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])]
54
54
            throw_args.replace(pytree.Node(syms.power, with_tb))
55
55
        else:
56
56
            throw_args.replace(Call(exc, args))