summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexanderlukanin13 <alexander.lukanin.13@gmail.com>2013-11-27 20:10:54 +0600
committeralexanderlukanin13 <alexander.lukanin.13@gmail.com>2013-11-27 20:10:54 +0600
commit23a3d2d504c1875d5eba8cc0abab3b127714c533 (patch)
tree82461cf48c281c3f9d61def7352298b8b53c6e13
parentfacf96b253205d58d46fe6ea780a81c2c7203d26 (diff)
downloadsix-23a3d2d504c1875d5eba8cc0abab3b127714c533.tar.gz
six.u 4-byte unicode escaping fixed ('\U00000439')
-rw-r--r--six.py2
-rw-r--r--test_six.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/six.py b/six.py
index 729ba7a..e4c0da4 100644
--- a/six.py
+++ b/six.py
@@ -469,7 +469,7 @@ else:
def b(s):
return s
# Workaround for standalone backslash
- _U = re.compile(r'\\(?!u)')
+ _U = re.compile(r'\\(?![uU])')
def u(s):
return unicode(_U.sub('\\u005C', s), "unicode_escape")
unichr = unichr
diff --git a/test_six.py b/test_six.py
index e233e97..94e33eb 100644
--- a/test_six.py
+++ b/test_six.py
@@ -385,9 +385,9 @@ if six.PY3:
def test_u():
- s = six.u("hi \u0439 \\ \\\\ \n")
+ s = six.u("hi \u0439 \U00000439 \\ \\\\ \n")
assert isinstance(s, str)
- assert s == "hi \u0439 \\ \\\\ \n"
+ assert s == "hi \u0439 \U00000439 \\ \\\\ \n"
else:
@@ -399,9 +399,9 @@ else:
def test_u():
- s = six.u("hi \u0439 \\ \\\\ \n")
+ s = six.u("hi \u0439 \U00000439 \\ \\\\ \n")
assert isinstance(s, unicode)
- assert s == "hi \xd0\xb9 \\ \\\\ \n".decode("utf8")
+ assert s == "hi \xd0\xb9 \xd0\xb9 \\ \\\\ \n".decode("utf8")
def test_u_escapes():