Might be clearer to have "self.offset[bpid] = data" as before or under a finally: statement.