8000 Call PyErr_NormalizeException for exceptions by slide · Pull Request #1265 · pythonnet/pythonnet · GitHub
[go: up one dir, main page]

Skip to content

Call PyErr_NormalizeException for exceptions #1265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Dec 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
slide committed Oct 15, 2020
commit a923e998b5626607217a0ba67d6a73c13512289c
13 changes: 13 additions & 0 deletions src/embed_tests/TestPythonException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,18 @@ public void TestPythonExceptionFormatNoTraceback()
Assert.AreEqual(ex.StackTrace, ex.Format());
}
}

[Test]
public void TestPythonExceptionFormatNormalized()
{
try
{
PythonEngine.Exec("a=b\n");
}
catch (PythonException ex)
{
Assert.AreEqual("Traceback (most recent call last):\n File \"<string>\", line 1, in <module>\nNameError: name 'b' is not defined\n", ex.Format());
}
}
}
}
0