mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
merge 3.4 (#24022)
This commit is contained in:
commit
273a720f87
3 changed files with 18 additions and 5 deletions
|
@ -1,9 +1,11 @@
|
|||
import math
|
||||
import os
|
||||
import unittest
|
||||
import sys
|
||||
import _ast
|
||||
import tempfile
|
||||
import types
|
||||
from test import support
|
||||
from test import support, script_helper
|
||||
|
||||
class TestSpecifics(unittest.TestCase):
|
||||
|
||||
|
@ -492,6 +494,16 @@ if 1:
|
|||
self.assertInvalidSingle('f()\nxy # blah\nblah()')
|
||||
self.assertInvalidSingle('x = 5 # comment\nx = 6\n')
|
||||
|
||||
def test_particularly_evil_undecodable(self):
|
||||
# Issue 24022
|
||||
src = b'0000\x00\n00000000000\n\x00\n\x9e\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