Exemplo n.º 1
0
        public static void settrace(CodeContext /*!*/ context, object o)
        {
            PythonContext pyContext = PythonContext.GetContext(context);

            pyContext.EnsureDebugContext();

            if (o == null)
            {
                pyContext.UnregisterTracebackHandler();
                PythonTracebackListener.SetTrace(null, null);
            }
            else
            {
                // We're following CPython behavior here.
                // If CurrentPythonFrame is not null then we're currently inside a traceback, and
                // enabling trace while inside a traceback is only allowed through sys.call_tracing()
                var pyThread = PythonOps.GetFunctionStackNoCreate();
                if (pyThread == null || !PythonTracebackListener.InTraceBack)
                {
                    pyContext.PushTracebackHandler(new PythonTracebackListener((PythonContext)context.LanguageContext));
                    pyContext.RegisterTracebackHandler();
                    PythonTracebackListener.SetTrace(o, (TracebackDelegate)Converter.ConvertToDelegate(o, typeof(TracebackDelegate)));
                }
            }
        }
Exemplo n.º 2
0
 internal TraceBackFrame(PythonTracebackListener traceAdapter, FunctionCode code, TraceBackFrame back, PythonDebuggingPayload debugProperties, Func <IDictionary <object, object> > scopeCallback)
 {
     _traceAdapter    = traceAdapter;
     _code            = code;
     _back            = back;
     _debugProperties = debugProperties;
     _scopeCallback   = scopeCallback;
 }
Exemplo n.º 3
0
 public static object gettrace(CodeContext /*!*/ context)
 {
     return(PythonTracebackListener.GetTraceObject());
 }
Exemplo n.º 4
0
 internal TraceBackFrame(PythonTracebackListener traceAdapter, FunctionCode code, TraceBackFrame back, PythonDebuggingPayload debugProperties, Func<IDictionary<object, object>> scopeCallback)
 {
     _traceAdapter = traceAdapter;
     _code = code;
     _back = back;
     _debugProperties = debugProperties;
     _scopeCallback = scopeCallback;
 }