diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-03 00:22:21 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-03 00:22:21 (GMT) |
commit | 151205f24f83f9dd538050912614848258e0f9d8 (patch) | |
tree | ce0e30f99d405e707f784be6cd22417040ae0ba2 /Lib | |
parent | 117ff17da3d032f10019be534d94be802702cd45 (diff) | |
download | cpython-151205f24f83f9dd538050912614848258e0f9d8.zip cpython-151205f24f83f9dd538050912614848258e0f9d8.tar.gz cpython-151205f24f83f9dd538050912614848258e0f9d8.tar.bz2 |
Merged revisions 78608 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r78608 | victor.stinner | 2010-03-03 01:18:49 +0100 (mer., 03 mars 2010) | 12 lines
Merged revisions 78603 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78603 | victor.stinner | 2010-03-03 00:20:02 +0100 (mer., 03 mars 2010) | 5 lines
Issue #7820: The parser tokenizer restores all bytes in the right if the BOM
check fails.
Fix an assertion in pydebug mode.
........
................
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_pep263.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_pep263.py b/Lib/test/test_pep263.py index 587b2fc..d5a5b3e 100644 --- a/Lib/test/test_pep263.py +++ b/Lib/test/test_pep263.py @@ -44,6 +44,17 @@ class PEP263Test(unittest.TestCase): self.assertEqual(len(d['a']), len(d['b'])) self.assertEqual(ascii(d['a']), ascii(d['b'])) + def test_issue7820(self): + # Ensure that check_bom() restores all bytes in the right order if + # check_bom() fails in pydebug mode: a buffer starts with the first + # byte of a valid BOM, but next bytes are different + + # one byte in common with the UTF-16-LE BOM + self.assertRaises(SyntaxError, eval, b'\xff\x20') + + # two bytes in common with the UTF-8 BOM + self.assertRaises(SyntaxError, eval, b'\xef\xbb\x20') + def test_main(): support.run_unittest(PEP263Test) |