]> granicus.if.org Git - python/commitdiff
Issue #18037: Do not escape '\u' and '\U' in raw strings.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 8 Oct 2013 18:07:21 +0000 (21:07 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 8 Oct 2013 18:07:21 +0000 (21:07 +0300)
Lib/lib2to3/fixes/fix_unicode.py
Lib/lib2to3/tests/test_fixers.py

index 922486b5d8510b1274d6b54c413b6c0fbf109f4b..2d776f61051e6f9236d308a088494d8b8c17acc9 100644 (file)
@@ -28,8 +28,7 @@ class FixUnicode(fixer_base.BaseFix):
             return new
         elif node.type == token.STRING:
             val = node.value
-            if (not self.unicode_literals and val[0] in u'rR\'"' and
-                u'\\' in val):
+            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'\\')
index 5f283a83598bda50afc15b30cabaeee379a284b4..6801c1703bb0f3be7c26606c6b2c0cd04076b29a 100644 (file)
@@ -2830,7 +2830,7 @@ class Test_unicode(FixerTestCase):
         self.check(b, a)
 
         b = """r'\\\\\\u20ac\\U0001d121\\\\u20ac'"""
-        a = """r'\\\\\\\\u20ac\\\\U0001d121\\\\u20ac'"""
+        a = """r'\\\\\\u20ac\\U0001d121\\\\u20ac'"""
         self.check(b, a)
 
     def test_bytes_literal_escape_u(self):