| # Copyright 2006 Google, Inc. All Rights Reserved. |
| # Licensed to PSF under a Contributor Agreement. |
| This converts usages of the exec statement into calls to a built-in |
| exec code in ns1, ns2 -> exec(code, ns1, ns2) |
| from .. import fixer_base |
| from ..fixer_util import Comma, Name, Call |
| class FixExec(fixer_base.BaseFix): |
| exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > |
| exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > |
| def transform(self, node, results): |
| args.extend([Comma(), b.clone()]) |
| args.extend([Comma(), c.clone()]) |
| return Call(Name(u"exec"), args, prefix=node.prefix) |