aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/lib2to3/fixes/fix_intern.py
diff options
context:
space:
mode:
authorGregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) <greg@krypto.org>2016-09-09 18:18:52 -0700
committerGregory P. Smith ext:(%20%5BGoogle%20Inc.%5D) <greg@krypto.org>2016-09-09 18:18:52 -0700
commit28325749c01815097aa2bc06508004a1f894c279 (patch)
tree83219772233a4f8b3d8db1df9bfb6b573fe39bfe /Lib/lib2to3/fixes/fix_intern.py
parentdbdf029a5575f6e6ec0140260236963ed7d2c2be (diff)
downloadcpython-28325749c01815097aa2bc06508004a1f894c279.tar.gz
cpython-28325749c01815097aa2bc06508004a1f894c279.zip
Issue #25969: Update the lib2to3 grammar to handle the unpacking
generalizations added in 3.5.
Diffstat (limited to 'Lib/lib2to3/fixes/fix_intern.py')
-rw-r--r--Lib/lib2to3/fixes/fix_intern.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/lib2to3/fixes/fix_intern.py b/Lib/lib2to3/fixes/fix_intern.py
index fb2973c2425..a852330908b 100644
--- a/Lib/lib2to3/fixes/fix_intern.py
+++ b/Lib/lib2to3/fixes/fix_intern.py
@@ -25,6 +25,16 @@ class FixIntern(fixer_base.BaseFix):
"""
def transform(self, node, results):
+ if results:
+ # 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...
+ 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 == '**'):
+ return # Make no change.
names = ('sys', 'intern')
new = ImportAndCall(node, results, names)
touch_import(None, 'sys', node)