[Python-checkins] cpython: Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond.

robert.collins python-checkins at python.org
Wed Jul 22 20:19:27 CEST 2015


https://hg.python.org/cpython/rev/b97b6cc381d7
changeset:   97001:b97b6cc381d7
user:        Robert Collins <rbtcollins at hp.com>
date:        Thu Jul 23 06:19:18 2015 +1200
summary:
  Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond.

files:
  Lib/lib2to3/fixes/fix_types.py   |  2 +-
  Lib/lib2to3/tests/test_fixers.py |  4 ++++
  Misc/NEWS                        |  2 ++
  3 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Lib/lib2to3/fixes/fix_types.py b/Lib/lib2to3/fixes/fix_types.py
--- a/Lib/lib2to3/fixes/fix_types.py
+++ b/Lib/lib2to3/fixes/fix_types.py
@@ -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 --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py
--- a/Lib/lib2to3/tests/test_fixers.py
+++ b/Lib/lib2to3/tests/test_fixers.py
@@ -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 --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list