[Python-checkins] cpython (3.3): Issue #18037: Do not escape '\u' and '\U' in raw strings.
serhiy.storchaka
python-checkins at python.org
Tue Oct 8 20:09:29 CEST 2013
http://hg.python.org/cpython/rev/acb2dacd0d24
changeset: 86146:acb2dacd0d24
branch: 3.3
parent: 86143:b6205505e1e4
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue Oct 08 21:07:46 2013 +0300
summary:
Issue #18037: Do not escape '\u' and '\U' in raw strings.
files:
Lib/lib2to3/fixes/fix_unicode.py | 3 +--
Lib/lib2to3/tests/test_fixers.py | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Lib/lib2to3/fixes/fix_unicode.py b/Lib/lib2to3/fixes/fix_unicode.py
--- 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 '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'\\')
diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py
--- a/Lib/lib2to3/tests/test_fixers.py
+++ b/Lib/lib2to3/tests/test_fixers.py
@@ -2830,7 +2830,7 @@
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):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list