diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-07-22 18:19:18 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-07-22 18:19:18 (GMT) |
commit | d4f4a6dddb91de101fa98a4e1c12e06a3ff058a6 (patch) | |
tree | e9731a11dc3d2b970e741c8133f347460f6933f9 /Lib/lib2to3 | |
parent | f25f788c6c4ec2bffd7f9b1e0bda70819cf82fa8 (diff) | |
download | cpython-d4f4a6dddb91de101fa98a4e1c12e06a3ff058a6.zip cpython-d4f4a6dddb91de101fa98a4e1c12e06a3ff058a6.tar.gz cpython-d4f4a6dddb91de101fa98a4e1c12e06a3ff058a6.tar.bz2 |
Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond.
Diffstat (limited to 'Lib/lib2to3')
-rw-r--r-- | Lib/lib2to3/fixes/fix_types.py | 2 | ||||
-rw-r--r-- | Lib/lib2to3/tests/test_fixers.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/lib2to3/fixes/fix_types.py b/Lib/lib2to3/fixes/fix_types.py index db34104..00327a7 100644 --- a/Lib/lib2to3/fixes/fix_types.py +++ b/Lib/lib2to3/fixes/fix_types.py @@ -42,7 +42,7 @@ _TYPE_MAPPING = { 'NotImplementedType' : 'type(NotImplemented)', 'SliceType' : 'slice', 'StringType': 'bytes', # XXX ? - 'StringTypes' : 'str', # XXX ? + 'StringTypes' : '(str,)', # XXX ? 'TupleType': 'tuple', 'TypeType' : 'type', 'UnicodeType': 'str', diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py index 06b0033..def9b0e 100644 --- a/Lib/lib2to3/tests/test_fixers.py +++ b/Lib/lib2to3/tests/test_fixers.py @@ -3322,6 +3322,10 @@ class Test_types(FixerTestCase): a = """type(None)""" self.check(b, a) + b = "types.StringTypes" + a = "(str,)" + self.check(b, a) + class Test_idioms(FixerTestCase): fixer = "idioms" |