Skip to content

Commit 1edaeb1

Browse files
committed
pyassem: flattenGraph: Assert that relative jump offset is non-negative.
CPython doesn't support negative offsets (absolute jumps should be used instead).
1 parent 3a72824 commit 1edaeb1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/pyassem.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ def flattenGraph(self):
450450
if opname in self.hasjrel:
451451
oparg = inst[1]
452452
offset = begin[oparg] - pc
453+
assert offset >= 0, "Offset value: %d" % offset
453454
insts[i] = opname, offset
454455
elif opname in self.hasjabs:
455456
insts[i] = opname, begin[inst[1]]

0 commit comments

Comments
 (0)