Skip to content

Commit

Permalink
Fix some small 3.10+ line number problems
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jun 15, 2024
1 parent ce90dac commit 89a8af3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xdis/codetype/code310.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def encode_lineno_tab(self):
co_linetable += bytearray([0, -127])
line_diff -= 127
if -127 <= line_diff <= 127:
co_linetable += bytearray([offset_diff, line_diff % 255])
co_linetable += bytearray([offset_diff, line_diff % 256])

self.co_linetable = co_linetable

Expand Down
3 changes: 2 additions & 1 deletion xdis/marsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ def dump_code3(self, x):
self.dump(x.co_filename)
self.dump(x.co_name)
self.w_long(x.co_firstlineno)
self.dump(x.co_lnotab)
linetable = x.co_linetable if hasattr(x, "co_linetable") else x.co_lnotab
self.dump(linetable)

dispatch[Code3] = dump_code3

Expand Down

0 comments on commit 89a8af3

Please sign in to comment.