import dis dix = dis def f(): dis.b() dix.b() print(dis.dis(f)) def getInstructions(): # please ignore show_caches ... this is a different bug return [bc for bc in dis.Bytecode(f, show_caches=True) if bc.opname != "CACHE"] global_dis, global_dix = [i for i in getInstructions() if i.opname == "LOAD_GLOBAL"] # the col_offset of both positions should be the same assert ( global_dis.positions[2:] == global_dix.positions[2:] ), f"missmatch in position column\n{global_dis}\n{global_dix}"