summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pep263.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pep263.py')
-rw-r--r--Lib/test/test_pep263.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_pep263.py b/Lib/test/test_pep263.py
index 8c1fbe7..e136a9c 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)