]> granicus.if.org Git - python/commit
bpo-38115: Deal with invalid bytecode offsets in lnotab (GH-16079) (GH-16464)
authorGregory P. Smith <greg@krypto.org>
Sat, 28 Sep 2019 15:22:00 +0000 (08:22 -0700)
committerGitHub <noreply@github.com>
Sat, 28 Sep 2019 15:22:00 +0000 (08:22 -0700)
commit36c6fa968016a46a39c3cdbd0a17ea5490dfa343
tree48e7d90e64baeb03445a200c263cf37c56b7d75a
parent8f478b489ae11633d2609dff0ef21d0e1a857417
bpo-38115: Deal with invalid bytecode offsets in lnotab (GH-16079) (GH-16464)

Document that lnotab can contain invalid bytecode offsets (because of
terrible reasons that are difficult to fix). Make dis.findlinestarts()
ignore invalid offsets in lnotab. All other uses of lnotab in CPython
(various reimplementations of addr2line or line2addr in Python, C and gdb)
already ignore this, because they take an address to look for, instead.

Add tests for the result of dis.findlinestarts() on wacky constructs in
test_peepholer.py, because it's the easiest place to add them.

(cherry picked from commit c8165036f374cd2ee64d4314eeb2514f7acb5026)
Lib/dis.py
Lib/test/test_peepholer.py
Misc/NEWS.d/next/Library/2019-09-13-09-24-58.bpo-38115.BOO-Y1.rst [new file with mode: 0644]
Objects/lnotab_notes.txt