Skip to content

Commit

Permalink
Exception is now grabbing line from top of call stack (last line in t…
Browse files Browse the repository at this point in the history
…race report)
  • Loading branch information
eirannejad committed Oct 5, 2023
1 parent f01ea00 commit 1671fc6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/runtime/McNeel.PythonEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,11 @@ public PyException(PythonException pyEx)
$"{pyEx.Type.Name}: {pyEx.Message}"
);

Match m = s_msgParser.Match(traceback);
if (m.Success
Match m = s_msgParser.Matches(traceback)
.OfType<Match>()
.LastOrDefault();
if (m is Match
&& m.Success
&& int.TryParse(m.Groups["line"].Value, out int line))
{
LineNumber = line;
Expand Down

0 comments on commit 1671fc6

Please sign in to comment.