summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-02-15 09:35:16 (GMT)
committerGitHub <noreply@github.com>2022-02-15 09:35:16 (GMT)
commit3be1a443ca8e7d4ba85f95b78df5c4122cae9ede (patch)
tree78b67b7f1b7a583bda33bf7f0788a55569f19287 /Lib/test/test_compile.py
parent12360aa159c42c7798fd14225d271e6fd84db7eb (diff)
downloadcpython-3be1a443ca8e7d4ba85f95b78df5c4122cae9ede.zip
cpython-3be1a443ca8e7d4ba85f95b78df5c4122cae9ede.tar.gz
cpython-3be1a443ca8e7d4ba85f95b78df5c4122cae9ede.tar.bz2
bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326)
* Make sure all backward jumps use JUMP_ABSOLUTE. * Add news. * Fix up news item. * Make test use consistent style.
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 0965015..7ebe837 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -1008,6 +1008,16 @@ if 1:
elif instr.opname in HANDLED_JUMPS:
self.assertNotEqual(instr.arg, (line + 1)*INSTR_SIZE)
+ def test_no_wraparound_jump(self):
+ # See https://bugs.python.org/issue46724
+
+ def while_not_chained(a, b, c):
+ while not (a < b < c):
+ pass
+
+ for instr in dis.Bytecode(while_not_chained):
+ self.assertNotEqual(instr.opname, "EXTENDED_ARG")
+
@requires_debug_ranges()
class TestSourcePositions(unittest.TestCase):
# Ensure that compiled code snippets have correct line and column numbers