diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-02 23:20:02 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-03-02 23:20:02 (GMT) |
commit | d23d3930ff1ce72263537bb050824129c6ac74f6 (patch) | |
tree | a742fd5b1cc1593e55c169a3b40919d28ea7dedd /Lib | |
parent | 0e717addd8a03ed10231a578fce894c07ddb157e (diff) | |
download | cpython-d23d3930ff1ce72263537bb050824129c6ac74f6.zip cpython-d23d3930ff1ce72263537bb050824129c6ac74f6.tar.gz cpython-d23d3930ff1ce72263537bb050824129c6ac74f6.tar.bz2 |
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 e4faa9f..9286467 100644 --- a/Lib/test/test_pep263.py +++ b/Lib/test/test_pep263.py @@ -30,6 +30,17 @@ class PEP263Test(unittest.TestCase): self.assertEqual(d['a'], d['b']) self.assertEqual(len(d['a']), len(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, '\xff\x20') + + # two bytes in common with the UTF-8 BOM + self.assertRaises(SyntaxError, eval, '\xef\xbb\x20') + def test_main(): test_support.run_unittest(PEP263Test) |