diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-14 13:11:17 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-14 13:11:17 (GMT) |
commit | 7e2b870b8593233306594237cd5286c60ec7a1e1 (patch) | |
tree | 612fa432059cc31904217e4bf55bed6c124576d0 /Lib/test/test_compile.py | |
parent | 2463001a15f0f1dab1b82e71f3d37b1bc7bc701f (diff) | |
parent | 0d441119f5eb6437f6145e89e0963f75494d8a3f (diff) | |
download | cpython-7e2b870b8593233306594237cd5286c60ec7a1e1.zip cpython-7e2b870b8593233306594237cd5286c60ec7a1e1.tar.gz cpython-7e2b870b8593233306594237cd5286c60ec7a1e1.tar.bz2 |
Issue #25388: Fixed tokenizer crash when processing undecodable source code
with a null byte.
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r-- | Lib/test/test_compile.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 39ef723..8935c65 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -516,6 +516,16 @@ if 1: res = script_helper.run_python_until_end(fn)[0] self.assertIn(b"Non-UTF-8", res.err) + def test_yet_more_evil_still_undecodable(self): + # Issue #25388 + src = b"#\x00\n#\xfd\n" + with tempfile.TemporaryDirectory() as tmpd: + fn = os.path.join(tmpd, "bad.py") + with open(fn, "wb") as fp: + fp.write(src) + res = script_helper.run_python_until_end(fn)[0] + self.assertIn(b"Non-UTF-8", res.err) + @support.cpython_only def test_compiler_recursion_limit(self): # Expected limit is sys.getrecursionlimit() * the scaling factor |