def display_stack_trace(port, cont): from pycket.prims.continuation_marks import cms_context context = cms_context.w_prim.call_interpret([values.W_ContinuationMarkSet(cont, values.w_default_continuation_prompt_tag)]) if isinstance(context, values.W_Cons): port.write("Error Trace:\n") total_frames_to_show = 10 count = 0 while isinstance(context, values.W_Cons): if count >= total_frames_to_show: break port.write("-- %s\n" % context.car().tostring()[:1000]) context = context.cdr() count += 1
def current_cont_marks(prompt_tag, env, cont): from pycket.interpreter import return_value return return_value(values.W_ContinuationMarkSet(cont), env, cont)
def continuation_marks(cont, prompt_tag): # TODO Prompt tag return values.W_ContinuationMarkSet(cont.cont, prompt_tag)