Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitce61a6f

Browse files
committed
Reverse Python traceback to match C# stacktrace order
1 parent5ae34ba commitce61a6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/runtime/pythonexception.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
usingSystem;
2+
usingSystem.Linq;
23
usingSystem.Runtime.CompilerServices;
34
usingSystem.Text;
45

@@ -44,6 +45,7 @@ public PythonException()
4445
}
4546
_message=type+" : "+message;
4647
}
48+
4749
if(_pyTB!=IntPtr.Zero)
4850
{
4951
usingPyObjecttb_module=PythonEngine.ImportModule("traceback");
@@ -54,7 +56,9 @@ public PythonException()
5456
usingvartbList=tb_module.InvokeMethod("format_tb",pyTB);
5557

5658
varsb=newStringBuilder();
57-
foreach(varlineintbList){
59+
// Reverse Python's traceback list to match the order used in C#
60+
// stacktraces
61+
foreach(varlineintbList.Reverse()){
5862
sb.Append(line.ToString());
5963
}
6064
_tb=sb.ToString();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp