@@ -163,12 +163,15 @@ def t_code_rust(self, save_ref, bytes_for_s: bool = False) -> Code313Rust:
163163 instr_count = self .read_int32 ()
164164 co_code = self .read_slice (instr_count * 2 )
165165
166- instructions = [int (co_code [i ]) for i in range (len (co_code ))] # debug
166+ # instructions = [int(co_code[i]) for i in range(len(co_code))] # debug
167+ co_lnotab = {}
167168
168169 # read locations
169170 loc_count = self .read_int32 ()
170171 locations : List [SourceLocation ] = []
171- for _ in range (loc_count ):
172+ last_line_number = - 1
173+ for i in range (loc_count ):
174+ offset = i * 2
172175 line_number = self .read_int32 ()
173176 if line_number == 0 :
174177 raise MarshalError ("invalid source location" )
@@ -180,6 +183,9 @@ def t_code_rust(self, save_ref, bytes_for_s: bool = False) -> Code313Rust:
180183 column_offset = char_off_zero_indexed + 1 # convert from zero-indexed
181184 )
182185 )
186+ if line_number != last_line_number and offset not in co_lnotab :
187+ co_lnotab [offset ] = line_number
188+ last_line_number = line_number
183189
184190 flags = self .read_int16 ()
185191
@@ -269,6 +275,7 @@ def read_names():
269275 co_argcount = arg_count ,
270276 co_posonlyargcount = posonlyarg_count ,
271277 co_kwonlyargcount = kwonlyarg_count ,
278+ co_lnotab = co_lnotab ,
272279 co_stacksize = max_stackdepth ,
273280 co_flags = flags ,
274281 co_code = co_code ,
0 commit comments