summaryrefslogtreecommitdiff
path: root/tests/stress/bytecode_limit.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stress/bytecode_limit.py')
-rw-r--r--tests/stress/bytecode_limit.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/stress/bytecode_limit.py b/tests/stress/bytecode_limit.py
new file mode 100644
index 000000000..0cb0c21e4
--- /dev/null
+++ b/tests/stress/bytecode_limit.py
@@ -0,0 +1,26 @@
+# Test the limits of bytecode generation.
+
+body = " with f()()() as a:\n try:\n f()()()\n except Exception:\n pass\n"
+
+# Test changing size of code info (source line/bytecode mapping) due to changing
+# bytecode size in the final passes. This test is very specific to how the
+# code info is encoded, and how jump offsets shrink in the final passes. This
+# test should fail if the bytecode emitter doesn't correctly handle shrinking of
+# the code info section.
+exec(
+ """
+x = 0
+if x:
+"""
+ + body * 13
+ + """
+x = [1 if x else 123]
+
+
+
+
+
+
+print(x)
+"""
+)