mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Issue #25388: Fixed tokenizer crash when processing undecodable source code
with a null byte.
This commit is contained in:
parent
806fb25405
commit
0d441119f5
3 changed files with 19 additions and 8 deletions
|
@ -504,6 +504,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue