summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes/fix_apply.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/fixes/fix_apply.py')
-rw-r--r--Lib/lib2to3/fixes/fix_apply.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/lib2to3/fixes/fix_apply.py b/Lib/lib2to3/fixes/fix_apply.py
index 6408582..1a465c2 100644
--- a/Lib/lib2to3/fixes/fix_apply.py
+++ b/Lib/lib2to3/fixes/fix_apply.py
@@ -37,8 +37,10 @@ class FixApply(fixer_base.BaseFix):
# I feel like we should be able to express this logic in the
# PATTERN above but I don't know how to do it so...
if args:
+ if args.type == self.syms.star_expr:
+ return # Make no change.
if (args.type == self.syms.argument and
- args.children[0].value in {'**', '*'}):
+ args.children[0].value == '**'):
return # Make no change.
if kwds and (kwds.type == self.syms.argument and
kwds.children[0].value == '**'):
@@ -56,12 +58,12 @@ class FixApply(fixer_base.BaseFix):
if kwds is not None:
kwds = kwds.clone()
kwds.prefix = ""
- l_newargs = [pytree.Leaf(token.STAR, "*"), args]
+ l_newargs = [pytree.Leaf(token.STAR, u"*"), args]
if kwds is not None:
l_newargs.extend([Comma(),
- pytree.Leaf(token.DOUBLESTAR, "**"),
+ pytree.Leaf(token.DOUBLESTAR, u"**"),
kwds])
- l_newargs[-2].prefix = " " # that's the ** token
+ l_newargs[-2].prefix = u" " # that's the ** token
# XXX Sometimes we could be cleverer, e.g. apply(f, (x, y) + t)
# can be translated into f(x, y, *t) instead of f(*(x, y) + t)
#new = pytree.Node(syms.power, (func, ArgList(l_newargs)))