Example #1
0
        public static void excepthook(CodeContext /*!*/ context, object exctype, object value, object traceback)
        {
            PythonContext pc = PythonContext.GetContext(context);

            PythonOps.PrintWithDest(
                context,
                pc.SystemStandardError,
                pc.FormatException(PythonExceptions.ToClr(value))
                );
        }
Example #2
0
        public static void excepthookImpl(CodeContext /*!*/ context, object exctype, object value, object traceback)
        {
            PythonContext pc  = context.LanguageContext;
            var           exc = PythonExceptions.ToClr(value);

            if (exc is null)
            {
                throw PythonOps.TypeError($"Exception expected for {nameof(value)}, {PythonTypeOps.GetName(value)} found");
            }

            PythonOps.PrintWithDest(
                context,
                pc.SystemStandardError,
                pc.FormatException(PythonExceptions.ToClr(value))
                );
        }