]> 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 db341047855f3236a74d52a930ef2436b6613fc5..00327a78e8eba50512c7950b689a979b287c6dd8 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 06b0033b8f77679106d786d8e9d959ac1707bd62..def9b0e47a5dbc29dfd82aff606640b33ce9ec75 100644 (file)
@@ -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"
 
index ce0bd5654c493d9271eb04388ef8e4a63a13ccd1..f2f7599bde0adef947fcf8f47050d31791197c6f 100644 (file)
--- 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.