summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2015-07-22 18:19:18 (GMT)
committerRobert Collins <rbtcollins@hp.com>2015-07-22 18:19:18 (GMT)
commit04fac8abf16600e139a70215db2697f6c7661539 (patch)
treee99cc81291c55ad2feb0c32a23a049edf67fddac
parentcdbe6fc23b0ce6b12fbe218e8d8c99640227117e (diff)
downloadcpython-04fac8abf16600e139a70215db2697f6c7661539.zip
cpython-04fac8abf16600e139a70215db2697f6c7661539.tar.gz
cpython-04fac8abf16600e139a70215db2697f6c7661539.tar.bz2
Issue #13938: 2to3 converts StringTypes to a tuple. Patch from Mark Hammond.
-rw-r--r--Lib/lib2to3/fixes/fix_types.py2
-rw-r--r--Lib/lib2to3/tests/test_fixers.py4
-rw-r--r--Misc/NEWS2
3 files changed, 7 insertions, 1 deletions
diff --git a/Lib/lib2to3/fixes/fix_types.py b/Lib/lib2to3/fixes/fix_types.py
index fc9d495..baaeabd 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 7db9af2..6fa603f 100644
--- a/Lib/lib2to3/tests/test_fixers.py
+++ b/Lib/lib2to3/tests/test_fixers.py
@@ -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"
diff --git a/Misc/NEWS b/Misc/NEWS
index 8c15bed..95d6e11 100644
--- 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).