Issue #18037: Do not escape '\u' and '\U' in raw strings.
This commit is contained in:
commit
1322f9e2d1
|
@ -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 'rR\'"' and
|
||||
'\\' in val):
|
||||
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'\\')
|
||||
|
|
|
@ -2889,7 +2889,7 @@ class Test_unicode(FixerTestCase):
|
|||
self.check(b, a)
|
||||
|
||||
b = r"""r'\\\u20ac\U0001d121\\u20ac'"""
|
||||
a = r"""r'\\\\u20ac\\U0001d121\\u20ac'"""
|
||||
a = r"""r'\\\u20ac\U0001d121\\u20ac'"""
|
||||
self.check(b, a)
|
||||
|
||||
def test_bytes_literal_escape_u(self):
|
||||
|
|
Loading…
Reference in New Issue