Check that the lnotab byte offsets are sensible.
(self, code)
| 69 | f'jumps to {tgt.opname} at {tgt.offset}') |
| 70 | |
| 71 | def check_lnotab(self, code): |
| 72 | "Check that the lnotab byte offsets are sensible." |
| 73 | code = dis._get_code_object(code) |
| 74 | lnotab = list(dis.findlinestarts(code)) |
| 75 | # Don't bother checking if the line info is sensible, because |
| 76 | # most of the line info we can get at comes from lnotab. |
| 77 | min_bytecode = min(t[0] for t in lnotab) |
| 78 | max_bytecode = max(t[0] for t in lnotab) |
| 79 | self.assertGreaterEqual(min_bytecode, 0) |
| 80 | self.assertLess(max_bytecode, len(code.co_code)) |
| 81 | # This could conceivably test more (and probably should, as there |
| 82 | # aren't very many tests of lnotab), if peepholer wasn't scheduled |
| 83 | # to be replaced anyway. |
| 84 | |
| 85 | def test_unot(self): |
| 86 | # UNARY_NOT POP_JUMP_IF_FALSE --> POP_JUMP_IF_TRUE' |
no test coverage detected