diff --git a/src/core/IronPython/Compiler/Ast/AstMethods.cs b/src/core/IronPython/Compiler/Ast/AstMethods.cs index da27a5ab0..c0275d530 100644 --- a/src/core/IronPython/Compiler/Ast/AstMethods.cs +++ b/src/core/IronPython/Compiler/Ast/AstMethods.cs @@ -37,7 +37,6 @@ internal static class AstMethods { public static readonly MethodInfo RemoveModule = GetMethod((Action)PythonOps.RemoveModule); public static readonly MethodInfo ModuleStarted = GetMethod((Action)PythonOps.ModuleStarted); public static readonly MethodInfo MakeRethrownException = GetMethod((Func)PythonOps.MakeRethrownException); - public static readonly MethodInfo MakeRethrowExceptionWorker = GetMethod((Func)PythonOps.MakeRethrowExceptionWorker); public static readonly MethodInfo MakeException = GetMethod((Func)PythonOps.MakeException); public static readonly MethodInfo MakeExceptionWithCause = GetMethod((Func)PythonOps.MakeExceptionWithCause); public static readonly MethodInfo MakeSlice = GetMethod((Func)PythonOps.MakeSlice); diff --git a/src/core/IronPython/Compiler/Ast/WithStatement.cs b/src/core/IronPython/Compiler/Ast/WithStatement.cs index 6712de29b..e21f5f69b 100644 --- a/src/core/IronPython/Compiler/Ast/WithStatement.cs +++ b/src/core/IronPython/Compiler/Ast/WithStatement.cs @@ -206,8 +206,8 @@ public override MSAst.Expression Reduce() { UpdateLineUpdated(true), Ast.Throw( Ast.Call( - AstMethods.MakeRethrowExceptionWorker, - exception + AstMethods.MakeRethrownException, + Parent.LocalContext ) ) ) diff --git a/src/core/IronPython/Runtime/Operations/PythonOps.cs b/src/core/IronPython/Runtime/Operations/PythonOps.cs index 82f0f75be..961de320b 100644 --- a/src/core/IronPython/Runtime/Operations/PythonOps.cs +++ b/src/core/IronPython/Runtime/Operations/PythonOps.cs @@ -2468,20 +2468,7 @@ public static PythonTuple GetExceptionInfo(CodeContext/*!*/ context) { public static Exception MakeRethrownException(CodeContext/*!*/ context) { PythonTuple t = GetExceptionInfo(context); Debug.Assert(t[1] == GetRawContextException()); - Exception e = MakeExceptionWorker(context, t[0], t[1], t[2], null, suppressContext: false, forRethrow: true); - return MakeRethrowExceptionWorker(e); - } - - /// - /// helper function for re-raised exception. - /// This entry point is used by 'raise' inside 'with' statement - /// - /// - /// - public static Exception MakeRethrowExceptionWorker(Exception e) { - e.RemoveTraceBack(); - ExceptionHelpers.UpdateForRethrow(e); - return e; + return MakeExceptionWorker(context, t[0], t[1], t[2], null, suppressContext: false, forRethrow: true); } public static Exception MakeException(CodeContext/*!*/ context, object exception) {