rocky / python-xdis

Python cross-version bytecode library and disassembler
GNU General Public License v2.0
300 stars 95 forks source link

Update findlinestarts to parse new format #117

Closed caandt closed 1 year ago

caandt commented 1 year ago

The format of the lnotab changed in 3.10. Although disassembling 3.10 from 3.10 is fine, line numbers are wrong when disassembling from a different version.

https://github.com/python/cpython/blob/main/Objects/lnotab_notes.txt

rocky commented 1 year ago

I am not seeing a problem disassembling 3.10 bytecode from 3.8. And the lnotab_notes.txt file says that line numbers change in 3.11, not 3.10 00_test.zip

There is currently a problem in disassembling 3.11 from non-3.11 but this does not address that.

rocky commented 1 year ago

In recent debugging I've been doing I now see that in some cases I am seeing negative numbers as line numbers. And that this fixes that.

So LGTM, although down the line this should be documented better. But I'll do that subsequently.