summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes/fix_unicode.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/fixes/fix_unicode.py')
-rw-r--r--Lib/lib2to3/fixes/fix_unicode.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/lib2to3/fixes/fix_unicode.py b/Lib/lib2to3/fixes/fix_unicode.py
index c7982c2..2d776f6 100644
--- a/Lib/lib2to3/fixes/fix_unicode.py
+++ b/Lib/lib2to3/fixes/fix_unicode.py
@@ -11,7 +11,7 @@ r"""Fixer for unicode.
from ..pgen2 import token
from .. import fixer_base
-_mapping = {"unichr" : "chr", "unicode" : "str"}
+_mapping = {u"unichr" : u"chr", u"unicode" : u"str"}
class FixUnicode(fixer_base.BaseFix):
BM_compatible = True
@@ -28,12 +28,12 @@ class FixUnicode(fixer_base.BaseFix):
return new
elif node.type == token.STRING:
val = node.value
- if not self.unicode_literals and val[0] in '\'"' and '\\' in val:
- val = r'\\'.join([
- v.replace('\\u', r'\\u').replace('\\U', r'\\U')
- for v in val.split(r'\\')
+ if not self.unicode_literals and val[0] in u'\'"' and u'\\' in val:
+ val = ur'\\'.join([
+ v.replace(u'\\u', ur'\\u').replace(u'\\U', ur'\\U')
+ for v in val.split(ur'\\')
])
- if val[0] in 'uU':
+ if val[0] in u'uU':
val = val[1:]
if val == node.value:
return node