diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-10-02 10:13:14 (GMT) | 
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-10-02 10:13:14 (GMT) | 
| commit | 58c8f2bb6de115b620cec3cf995f04005573765c (patch) | |
| tree | d5baea3027a00eb820002365608c30762d7da22e /Lib/test/test_unicode.py | |
| parent | b9d98d532cb9bdebff9854eaff91fea13769a595 (diff) | |
| parent | 28b21e50c8f1bc9f4524b02df75b83f3b5efacb4 (diff) | |
| download | cpython-58c8f2bb6de115b620cec3cf995f04005573765c.zip cpython-58c8f2bb6de115b620cec3cf995f04005573765c.tar.gz cpython-58c8f2bb6de115b620cec3cf995f04005573765c.tar.bz2 | |
Issue #24848: Fixed bugs in UTF-7 decoding of misformed data:
1. Non-ASCII bytes were accepted after shift sequence.
2. A low surrogate could be emitted in case of error in high surrogate.
3. In some circumstances the '\xfd' character was produced instead of the
replacement character '\ufffd' (due to a bug in _PyUnicodeWriter).
Diffstat (limited to 'Lib/test/test_unicode.py')
| -rw-r--r-- | Lib/test/test_unicode.py | 3 | 
1 files changed, 2 insertions, 1 deletions
| diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 3fcb590..1429a6d 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1553,7 +1553,7 @@ class UnicodeTest(string_tests.CommonTest,          self.assertEqual(b'+2AHab9ze-'.decode('utf-7'), '\uD801\U000abcde')          # Issue #2242: crash on some Windows/MSVC versions -        self.assertEqual(b'+\xc1'.decode('utf-7'), '\xc1') +        self.assertEqual(b'+\xc1'.decode('utf-7', 'ignore'), '')          # Direct encoded characters          set_d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'(),-./:?" @@ -1995,6 +1995,7 @@ class UnicodeTest(string_tests.CommonTest,          self.assertRaises(UnicodeError, str, b'Andr\202 x', 'ascii', 'strict')          self.assertEqual(str(b'Andr\202 x', 'ascii', 'ignore'), "Andr x")          self.assertEqual(str(b'Andr\202 x', 'ascii', 'replace'), 'Andr\uFFFD x') +        self.assertEqual(str(b'\202 x', 'ascii', 'replace'), '\uFFFD x')          # Error handling (unknown character names)          self.assertEqual(b"\\N{foo}xx".decode("unicode-escape", "ignore"), "xx") | 
