changeset: 97001:b97b6cc381d7 user: Robert Collins date: Thu Jul 23 06:19:18 2015 +1200 files: Lib/lib2to3/fixes/fix_types.py Lib/lib2to3/tests/test_fixers.py Misc/NEWS description: Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond. diff -r 7999671dc991 -r b97b6cc381d7 Lib/lib2to3/fixes/fix_types.py --- a/Lib/lib2to3/fixes/fix_types.py Wed Jul 22 19:26:09 2015 +0300 +++ b/Lib/lib2to3/fixes/fix_types.py Thu Jul 23 06:19:18 2015 +1200 @@ -42,7 +42,7 @@ 'NotImplementedType' : 'type(NotImplemented)', 'SliceType' : 'slice', 'StringType': 'bytes', # XXX ? - 'StringTypes' : 'str', # XXX ? + 'StringTypes' : '(str,)', # XXX ? 'TupleType': 'tuple', 'TypeType' : 'type', 'UnicodeType': 'str', diff -r 7999671dc991 -r b97b6cc381d7 Lib/lib2to3/tests/test_fixers.py --- a/Lib/lib2to3/tests/test_fixers.py Wed Jul 22 19:26:09 2015 +0300 +++ b/Lib/lib2to3/tests/test_fixers.py Thu Jul 23 06:19:18 2015 +1200 @@ -3322,6 +3322,10 @@ a = """type(None)""" self.check(b, a) + b = "types.StringTypes" + a = "(str,)" + self.check(b, a) + class Test_idioms(FixerTestCase): fixer = "idioms" diff -r 7999671dc991 -r b97b6cc381d7 Misc/NEWS --- a/Misc/NEWS Wed Jul 22 19:26:09 2015 +0300 +++ b/Misc/NEWS Thu Jul 23 06:19:18 2015 +1200 @@ -13,6 +13,8 @@ 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.