]> granicus.if.org Git - python/commitdiff
Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond.
authorRobert Collins <rbtcollins@hp.com>
Wed, 22 Jul 2015 18:19:18 +0000 (06:19 +1200)
committerRobert Collins <rbtcollins@hp.com>
Wed, 22 Jul 2015 18:19:18 +0000 (06:19 +1200)
Lib/lib2to3/fixes/fix_types.py
Lib/lib2to3/tests/test_fixers.py
Misc/NEWS

index fc9d4959276a716970d020dab580cb613e0f6217..baaeabd97271288aa63ef6164066bab8f43d4df5 100644 (file)
@@ -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',
index 7db9af217b08ac60c1eeb64b032d6837103a5d00..6fa603fd391c18a0c8b500a57bb4373acddf258e 100644 (file)
@@ -3263,6 +3263,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"
 
index 8c15bed27d8aee4db5022431bf9eb1456c9b4132..95d6e1186c78885572584b4f2a5563b00b027620 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond.
+
 - Issue #24611: Fixed compiling the posix module on non-Windows platforms
   without mknod() or makedev() (e.g. on Unixware).