aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pytest/py2/patches/04-support-cyrillic-id.patch
blob: 26242ff97048d6c0cbed087b62a1bd329b5f000e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- contrib/python/pytest/py2/_pytest/compat.py	(index)
+++ contrib/python/pytest/py2/_pytest/compat.py	(working tree)
@@ -243,7 +243,7 @@ if _PY3:
         if isinstance(val, bytes):
             ret = _bytes_to_ascii(val)
         else:
-            ret = val.encode("unicode_escape").decode("ascii")
+            ret = val
         return _translate_non_printable(ret)
 
 
@@ -262,11 +262,11 @@ else:
         """
         if isinstance(val, bytes):
             try:
-                ret = val.decode("ascii")
+                ret = val.decode("utf-8")
             except UnicodeDecodeError:
-                ret = val.encode("string-escape").decode("ascii")
+                ret = val.decode("utf-8", "ignore")
         else:
-            ret = val.encode("unicode-escape").decode("ascii")
+            ret = val.encode("utf-8", "replace").decode("utf-8")
         return _translate_non_printable(ret)