From: Robert Collins Date: Wed, 22 Jul 2015 18:19:18 +0000 (+1200) Subject: Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. X-Git-Tag: v3.6.0a1~1933 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4f4a6dddb91de101fa98a4e1c12e06a3ff058a6;p=python Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. --- diff --git a/Lib/lib2to3/fixes/fix_types.py b/Lib/lib2to3/fixes/fix_types.py index db34104785..00327a78e8 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 06b0033b8f..def9b0e47a 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" diff --git a/Misc/NEWS b/Misc/NEWS index ce0bd5654c..f2f7599bde 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Core and Builtins Library ------- +- Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. + - Issue #8585: improved tests for zipimporter2. Patch from Mark Lawrence. - Issue #18622: unittest.mock.mock_open().reset_mock would recurse infinitely.