diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-02-27 15:15:10 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-02-27 15:15:10 (GMT) |
commit | 957c329db01786e404187bb3b6b0c948e2689d7a (patch) | |
tree | 5f47915c05060dc99ae9e14adb6a7d99d29c9162 | |
parent | b6d80cc893d6de3a958d1d7dbc8e640d5f4f6628 (diff) | |
download | cpython-957c329db01786e404187bb3b6b0c948e2689d7a.zip cpython-957c329db01786e404187bb3b6b0c948e2689d7a.tar.gz cpython-957c329db01786e404187bb3b6b0c948e2689d7a.tar.bz2 |
Merged revisions 78497 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78497 | florent.xicluna | 2010-02-27 16:10:19 +0100 (sam, 27 fév 2010) | 2 lines
#7793: Fix RuntimeError when running "regrtest -R" for multibyte codecs.
........
-rw-r--r-- | Lib/test/test_multibytecodec_support.py | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py index feefa97..82e46d6 100644 --- a/Lib/test/test_multibytecodec_support.py +++ b/Lib/test/test_multibytecodec_support.py @@ -243,22 +243,6 @@ class TestBase: self.assertEqual(ostream.getvalue(), self.tstring[0]) -if len(u'\U00012345') == 2: # ucs2 build - _unichr = unichr - def unichr(v): - if v >= 0x10000: - return _unichr(0xd800 + ((v - 0x10000) >> 10)) + \ - _unichr(0xdc00 + ((v - 0x10000) & 0x3ff)) - else: - return _unichr(v) - _ord = ord - def ord(c): - if len(c) == 2: - return 0x10000 + ((_ord(c[0]) - 0xd800) << 10) + \ - (ord(c[1]) - 0xdc00) - else: - return _ord(c) - class TestBase_Mapping(unittest.TestCase): pass_enctest = [] pass_dectest = [] @@ -281,7 +265,8 @@ class TestBase_Mapping(unittest.TestCase): self._test_mapping_file_plain() def _test_mapping_file_plain(self): - unichrs = lambda s: u''.join(map(unichr, map(eval, s.split('+')))) + _unichr = lambda c: eval("u'\\U%08x'" % int(c, 16)) + unichrs = lambda s: u''.join(_unichr(c) for c in s.split('+')) urt_wa = {} for line in self.open_mapping_file(): @@ -306,7 +291,7 @@ class TestBase_Mapping(unittest.TestCase): continue unich = unichrs(data[1]) - if ord(unich) == 0xfffd or urt_wa.has_key(unich): + if unich == u'\ufffd' or unich in urt_wa: continue urt_wa[unich] = csetch |