def __reduce__(self): one, two, coro_state = coroutine.__reduce__(self) assert one is coroutine assert two == () # we want to get rid of the parent thing. # for now, we just drop it a, b, c, d = coro_state # Removing all frames related to stackless.py. # They point to stuff we don't want to be pickled. frame_list = list(b) new_frame_list = [] for frame in frame_list: if frame.f_code == schedule.func_code: # Removing everything including and after the # call to stackless.schedule() break new_frame_list.append(frame) b = tuple(new_frame_list) if d: assert isinstance(d, coroutine) coro_state = a, b, c, None coro_state, alive, tempval = rewrite_stackless_primitive( coro_state, self.alive, self.tempval) inst_dict = self.__dict__.copy() inst_dict.pop('tempval', None) return self.__class__, (), (coro_state, alive, tempval, inst_dict)
def __reduce__(self): one, two, coro_state = coroutine.__reduce__(self) assert one is coroutine assert two == () # we want to get rid of the parent thing. # for now, we just drop it a, b, c, d = coro_state # Removing all frames related to stackless.py. # They point to stuff we don't want to be pickled. frame_list = list(b) new_frame_list = [] for frame in frame_list: if frame.f_code == schedule.func_code: # Removing everything including and after the # call to stackless.schedule() break new_frame_list.append(frame) b = tuple(new_frame_list) if d: assert isinstance(d, coroutine) coro_state = a, b, c, None coro_state, alive, tempval = rewrite_stackless_primitive(coro_state, self.alive, self.tempval) inst_dict = self.__dict__.copy() inst_dict.pop('tempval', None) return self.__class__, (), (coro_state, alive, tempval, inst_dict)
def __reduce__(self): one, two, coro_state = coroutine.__reduce__(self) assert one is coroutine assert two == () # we want to get rid of the parent thing. # for now, we just drop it a, frame, c, d = coro_state # Removing all frames related to stackless.py. # They point to stuff we don't want to be pickled. pickleframe = frame while frame is not None: if frame.f_code == schedule.func_code: # Removing everything including and after the # call to stackless.schedule() pickleframe = frame.f_back break frame = frame.f_back if d: assert isinstance(d, coroutine) coro_state = a, pickleframe, c, None coro_state, alive, tempval = rewrite_stackless_primitive(coro_state, self.alive, self.tempval) inst_dict = self.__dict__.copy() inst_dict.pop('tempval', None) return self.__class__, (), (coro_state, alive, tempval, inst_dict)
def __reduce__(self): one, two, coro_state = coroutine.__reduce__(self) assert one is coroutine assert two == () # we want to get rid of the parent thing. # for now, we just drop it a, b, c, d = coro_state if d: assert isinstance(d, coroutine) coro_state = a, b, c, None coro_state, alive, tempval = rewrite_stackless_primitive(coro_state, self.alive, self.tempval) inst_dict = self.__dict__.copy() del inst_dict['tempval'] return self.__class__, (), (coro_state, alive, tempval, inst_dict)
def __reduce__(self): # xxx save more one, two, three = coroutine.__reduce__(self) assert one is coroutine assert two == () return tasklet, (), (three, self.alive, self.tempval)