Skip to content

Commit 25865a3

Browse files
committed
add test
1 parent 091f6f4 commit 25865a3

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎Lib/test/test_compile.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,27 @@ def test_assemble_init_allocation_failure(self):
5959
""")
6060
script_helper.assert_python_ok('-c', code)
6161

62+
@support.requires_subprocess()
63+
@support.nomemtest
64+
def test_push_cold_blocks_to_end_allocation_failure(self):
65+
code = textwrap.dedent("""
66+
from test import support
67+
68+
source = "async def f():\\n await x\\n"
69+
for n in range(1, 1000):
70+
with support.inject_memory_error_cm(n, n + 1):
71+
try:
72+
compile(source, "<test>", "exec")
73+
except MemoryError:
74+
continue
75+
break
76+
else:
77+
raise AssertionError("compile() never succeeded")
78+
if n == 1:
79+
raise AssertionError("no MemoryError raised")
80+
""")
81+
script_helper.assert_python_ok('-c', code)
82+
6283
def test_other_newlines(self):
6384
compile("\r\n", "<test>", "exec")
6485
compile("\r", "<test>", "exec")

0 commit comments

Comments
 (0)