Issue #18037: Do not escape '\u' and '\U' in raw strings.
diff --git a/Lib/lib2to3/fixes/fix_unicode.py b/Lib/lib2to3/fixes/fix_unicode.py
index 922486b..2d776f6 100644
--- a/Lib/lib2to3/fixes/fix_unicode.py
+++ b/Lib/lib2to3/fixes/fix_unicode.py
@@ -28,8 +28,7 @@
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'\\')
diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py
index 5f283a8..6801c17 100644
--- a/Lib/lib2to3/tests/test_fixers.py
+++ b/Lib/lib2to3/tests/test_fixers.py
@@ -2830,7 +2830,7 @@
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):