diff --git a/xdis/codetype/code310.py b/xdis/codetype/code310.py index 9f155dd5..4d8fd3fd 100644 --- a/xdis/codetype/code310.py +++ b/xdis/codetype/code310.py @@ -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 diff --git a/xdis/marsh.py b/xdis/marsh.py index cc7871ef..f094c01e 100644 --- a/xdis/marsh.py +++ b/xdis/marsh.py @@ -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