summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes
diff options
context:
space:
mode:
authorZsolt Dollenstein <zsol.zsol@gmail.com>2019-10-24 06:19:07 (GMT)
committerMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>2019-10-24 06:19:07 (GMT)
commit96b06aefe23521b61e4e9cdd44f5d30b00c7eb95 (patch)
treecb3193c53116b83c483afae524b4c1015bf4e2af /Lib/lib2to3/fixes
parent3bbb6db545eff73ba4031bd9b8f2ef71b84c906e (diff)
downloadcpython-96b06aefe23521b61e4e9cdd44f5d30b00c7eb95.zip
cpython-96b06aefe23521b61e4e9cdd44f5d30b00c7eb95.tar.gz
cpython-96b06aefe23521b61e4e9cdd44f5d30b00c7eb95.tar.bz2
bpo-33348: parse expressions after * and ** in lib2to3 (GH-6586)
These are valid even in python 2.7 https://bugs.python.org/issue33348 Automerge-Triggered-By: @gpshead
Diffstat (limited to 'Lib/lib2to3/fixes')
-rw-r--r--Lib/lib2to3/fixes/fix_apply.py4
-rw-r--r--Lib/lib2to3/fixes/fix_intern.py4
-rw-r--r--Lib/lib2to3/fixes/fix_reload.py4
3 files changed, 3 insertions, 9 deletions
diff --git a/Lib/lib2to3/fixes/fix_apply.py b/Lib/lib2to3/fixes/fix_apply.py
index 826ec8c..6408582 100644
--- a/Lib/lib2to3/fixes/fix_apply.py
+++ b/Lib/lib2to3/fixes/fix_apply.py
@@ -37,10 +37,8 @@ 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 == '**'):
+ args.children[0].value in {'**', '*'}):
return # Make no change.
if kwds and (kwds.type == self.syms.argument and
kwds.children[0].value == '**'):
diff --git a/Lib/lib2to3/fixes/fix_intern.py b/Lib/lib2to3/fixes/fix_intern.py
index a852330..d752843 100644
--- a/Lib/lib2to3/fixes/fix_intern.py
+++ b/Lib/lib2to3/fixes/fix_intern.py
@@ -30,10 +30,8 @@ class FixIntern(fixer_base.BaseFix):
# PATTERN above but I don't know how to do it so...
obj = results['obj']
if obj:
- if obj.type == self.syms.star_expr:
- return # Make no change.
if (obj.type == self.syms.argument and
- obj.children[0].value == '**'):
+ obj.children[0].value in {'**', '*'}):
return # Make no change.
names = ('sys', 'intern')
new = ImportAndCall(node, results, names)
diff --git a/Lib/lib2to3/fixes/fix_reload.py b/Lib/lib2to3/fixes/fix_reload.py
index 6c7fbbd..b308411 100644
--- a/Lib/lib2to3/fixes/fix_reload.py
+++ b/Lib/lib2to3/fixes/fix_reload.py
@@ -27,10 +27,8 @@ class FixReload(fixer_base.BaseFix):
# PATTERN above but I don't know how to do it so...
obj = results['obj']
if obj:
- if obj.type == self.syms.star_expr:
- return # Make no change.
if (obj.type == self.syms.argument and
- obj.children[0].value == '**'):
+ obj.children[0].value in {'**', '*'}):
return # Make no change.
names = ('importlib', 'reload')
new = ImportAndCall(node, results, names)