def descr__reduce__(self, space): from pypy.interpreter.mixedmodule import MixedModule from pypy.module._pickle_support import maker # helper fns w_mod = space.getbuiltinmodule('_pickle_support') mod = space.interp_w(MixedModule, w_mod) new_inst = mod.get('frame_new') w = space.wrap nt = space.newtuple cells = self._getcells() if cells is None: w_cells = space.w_None else: w_cells = space.newlist([space.wrap(cell) for cell in cells]) if self.w_f_trace is None: f_lineno = self.get_last_lineno() else: f_lineno = self.f_lineno nlocals = self.pycode.co_nlocals values_w = self.locals_stack_w[nlocals:self.valuestackdepth] w_valuestack = maker.slp_into_tuple_with_nulls(space, values_w) w_blockstack = nt( [block._get_state_(space) for block in self.get_blocklist()]) w_fastlocals = maker.slp_into_tuple_with_nulls( space, self.locals_stack_w[:nlocals]) if self.last_exception is None: w_exc_value = space.w_None w_tb = space.w_None else: w_exc_value = self.last_exception.get_w_value(space) w_tb = w(self.last_exception.get_traceback()) tup_state = [ w(self.f_backref()), w(self.get_builtin()), w(self.pycode), w_valuestack, w_blockstack, w_exc_value, # last_exception w_tb, # self.w_globals, w(self.last_instr), w(self.frame_finished_execution), w(f_lineno), w_fastlocals, space.w_None, #XXX placeholder for f_locals #f_restricted requires no additional data! space.w_None, ## self.w_f_trace, ignore for now w(self.instr_lb), #do we need these three (that are for tracing) w(self.instr_ub), w(self.instr_prev_plus_one), w_cells, ] return nt([new_inst, nt([]), nt(tup_state)])
def descr__reduce__(self, space): from pypy.interpreter.mixedmodule import MixedModule from pypy.module._pickle_support import maker # helper fns w_mod = space.getbuiltinmodule('_pickle_support') mod = space.interp_w(MixedModule, w_mod) new_inst = mod.get('frame_new') w = space.wrap nt = space.newtuple cells = self._getcells() if cells is None: w_cells = space.w_None else: w_cells = space.newlist([space.wrap(cell) for cell in cells]) if self.w_f_trace is None: f_lineno = self.get_last_lineno() else: f_lineno = self.f_lineno nlocals = self.pycode.co_nlocals values_w = self.locals_stack_w[nlocals:self.valuestackdepth] w_valuestack = maker.slp_into_tuple_with_nulls(space, values_w) w_blockstack = nt([block._get_state_(space) for block in self.get_blocklist()]) w_fastlocals = maker.slp_into_tuple_with_nulls( space, self.locals_stack_w[:nlocals]) if self.last_exception is None: w_exc_value = space.w_None w_tb = space.w_None else: w_exc_value = self.last_exception.get_w_value(space) w_tb = w(self.last_exception.get_traceback()) tup_state = [ w(self.f_backref()), w(self.get_builtin()), w(self.pycode), w_valuestack, w_blockstack, w_exc_value, # last_exception w_tb, # self.w_globals, w(self.last_instr), w(self.frame_finished_execution), w(f_lineno), w_fastlocals, space.w_None, #XXX placeholder for f_locals #f_restricted requires no additional data! space.w_None, ## self.w_f_trace, ignore for now w(self.instr_lb), #do we need these three (that are for tracing) w(self.instr_ub), w(self.instr_prev_plus_one), w_cells, ] return nt([new_inst, nt([]), nt(tup_state)])
def _reduce_state(self, space): from pypy.module._pickle_support import maker # helper fns w = space.wrap nt = space.newtuple cells = self.cells if cells is None: w_cells = space.w_None else: w_cells = space.newlist([space.wrap(cell) for cell in cells]) if self.get_w_f_trace() is None: f_lineno = self.get_last_lineno() else: f_lineno = self.getorcreatedebug().f_lineno nlocals = self.pycode.co_nlocals values_w = self.locals_stack_w[nlocals:self.valuestackdepth] w_valuestack = maker.slp_into_tuple_with_nulls(space, values_w) w_blockstack = nt( [block._get_state_(space) for block in self.get_blocklist()]) w_fastlocals = maker.slp_into_tuple_with_nulls( space, self.locals_stack_w[:nlocals]) if self.last_exception is None: w_exc_value = space.w_None w_tb = space.w_None else: w_exc_value = self.last_exception.get_w_value(space) w_tb = w(self.last_exception.get_traceback()) d = self.getorcreatedebug() tup_state = [ w(self.f_backref()), w(self.get_builtin()), w(self.pycode), w_valuestack, w_blockstack, w_exc_value, # last_exception w_tb, # self.w_globals, w(self.last_instr), w(f_lineno), w_fastlocals, space.w_None, #XXX placeholder for f_locals #f_restricted requires no additional data! space.w_None, w(d.instr_lb), w(d.instr_ub), w(d.instr_prev_plus_one), w_cells, ] return nt(tup_state)
def _reduce_state(self, space): from pypy.module._pickle_support import maker # helper fns nt = space.newtuple if self.get_w_f_trace() is None: f_lineno = self.get_last_lineno() else: f_lineno = self.getorcreatedebug().f_lineno nlocals = self.pycode.co_nlocals values_w = self.locals_cells_stack_w w_locals_cells_stack = maker.slp_into_tuple_with_nulls(space, values_w) w_blockstack = nt( [block._get_state_(space) for block in self.get_blocklist()]) if self.last_exception is None: w_exc_value = space.w_None w_tb = space.w_None else: w_exc_value = self.last_exception.get_w_value(space) w_tb = self.last_exception.get_w_traceback(space) d = self.getorcreatedebug() w_backref = self.f_backref() if w_backref is None: w_backref = space.w_None tup_state = [ w_backref, self.get_builtin(), self.pycode, w_locals_cells_stack, w_blockstack, w_exc_value, # last_exception w_tb, # self.get_w_globals(), space.newint(self.last_instr), space.newbool(self.frame_finished_execution), space.newint(f_lineno), space.w_None, #XXX placeholder for f_locals #f_restricted requires no additional data! space.w_None, space.newint(d.instr_lb), space.newint(d.instr_ub), space.newint(d.instr_prev_plus_one), space.newint(self.valuestackdepth), ] return nt(tup_state)
def _reduce_state(self, space): from pypy.module._pickle_support import maker # helper fns w = space.wrap nt = space.newtuple if self.get_w_f_trace() is None: f_lineno = self.get_last_lineno() else: f_lineno = self.getorcreatedebug().f_lineno nlocals = self.pycode.co_nlocals values_w = self.locals_cells_stack_w w_locals_cells_stack = maker.slp_into_tuple_with_nulls(space, values_w) w_blockstack = nt([block._get_state_(space) for block in self.get_blocklist()]) if self.last_exception is None: w_exc_value = space.w_None w_tb = space.w_None else: w_exc_value = self.last_exception.get_w_value(space) w_tb = w(self.last_exception.get_traceback()) d = self.getorcreatedebug() tup_state = [ w(self.f_backref()), w(self.get_builtin()), w(self.pycode), w_locals_cells_stack, w_blockstack, w_exc_value, # last_exception w_tb, # self.get_w_globals(), w(self.last_instr), w(self.frame_finished_execution), w(f_lineno), space.w_None, #XXX placeholder for f_locals #f_restricted requires no additional data! space.w_None, w(d.instr_lb), w(d.instr_ub), w(d.instr_prev_plus_one), w(self.valuestackdepth), ] return nt(tup_state)