Skip to content

Commit 182256d

Browse files
committed
tests/stress: Adjust bytecode_limit test so it can SKIP if no memory.
Signed-off-by: Damien George <damien@micropython.org>
1 parent c7271a8 commit 182256d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

tests/stress/bytecode_limit.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
body = " with f()()() as a:\n try:\n f()()()\n except Exception:\n pass\n"
44

5+
# Test overflow of jump offset.
6+
for n in (430, 431, 432, 433):
7+
try:
8+
exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n")
9+
except MemoryError:
10+
print("SKIP")
11+
raise SystemExit
12+
except RuntimeError:
13+
print("RuntimeError")
14+
515
# Test changing size of code info (source line/bytecode mapping) due to changing
616
# bytecode size in the final passes. This test is very specific to how the
717
# code info is encoded, and how jump offsets shrink in the final passes. This
@@ -24,10 +34,3 @@
2434
print(x)
2535
"""
2636
)
27-
28-
# Test overflow of jump offset.
29-
for n in (430, 431, 432, 433):
30-
try:
31-
exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n")
32-
except RuntimeError:
33-
print("RuntimeError")

tests/stress/bytecode_limit.py.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[123]
21
cond false
32
cond false
43
RuntimeError
54
RuntimeError
5+
[123]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy