Blame SOURCES/00355-CVE-2020-27619.patch

d9cf46
diff --git a/Lib/test/multibytecodec_support.py b/Lib/test/multibytecodec_support.py
d9cf46
index 5b2329b6d84..53b5d64d453 100644
d9cf46
--- a/Lib/test/multibytecodec_support.py
d9cf46
+++ b/Lib/test/multibytecodec_support.py
d9cf46
@@ -279,30 +279,22 @@ class TestBase_Mapping(unittest.TestCase):
d9cf46
             self._test_mapping_file_plain()
d9cf46
 
d9cf46
     def _test_mapping_file_plain(self):
d9cf46
-        _unichr = lambda c: eval("u'\\U%08x'" % int(c, 16))
d9cf46
-        unichrs = lambda s: u''.join(_unichr(c) for c in s.split('+'))
d9cf46
+        def unichrs(s):
d9cf46
+            return ''.join(unichr(int(x, 16)) for x in s.split('+'))
d9cf46
         urt_wa = {}
d9cf46
 
d9cf46
         with self.open_mapping_file() as f:
d9cf46
             for line in f:
d9cf46
                 if not line:
d9cf46
                     break
d9cf46
-                data = line.split('#')[0].strip().split()
d9cf46
+                data = line.split('#')[0].split()
d9cf46
                 if len(data) != 2:
d9cf46
                     continue
d9cf46
 
d9cf46
-                csetval = eval(data[0])
d9cf46
-                if csetval <= 0x7F:
d9cf46
-                    csetch = chr(csetval & 0xff)
d9cf46
-                elif csetval >= 0x1000000:
d9cf46
-                    csetch = chr(csetval >> 24) + chr((csetval >> 16) & 0xff) + \
d9cf46
-                             chr((csetval >> 8) & 0xff) + chr(csetval & 0xff)
d9cf46
-                elif csetval >= 0x10000:
d9cf46
-                    csetch = chr(csetval >> 16) + \
d9cf46
-                             chr((csetval >> 8) & 0xff) + chr(csetval & 0xff)
d9cf46
-                elif csetval >= 0x100:
d9cf46
-                    csetch = chr(csetval >> 8) + chr(csetval & 0xff)
d9cf46
-                else:
d9cf46
+                if data[0][:2] != '0x':
d9cf46
+                    self.fail("Invalid line: {!r}".format(line))
d9cf46
+                csetch = bytes.fromhex(data[0][2:])
d9cf46
+                if len(csetch) == 1 and 0x80 <= csetch[0]:
d9cf46
                     continue
d9cf46
 
d9cf46
                 unich = unichrs(data[1])