FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Changed the PythonException.Message value so it displays the name of … · pythonnet/pythonnet@462a429 · GitHub

Commit 462a429

Browse files
Virgil Dupras
committed
Changed the PythonException.Message value so it displays the name of the exception class instead ("Exception") instead of its representation ("<type 'exceptions.Exception'>").
1 parent e2aff66 commit 462a429

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎pythonnet/src/embed_tests/pythonexception.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void TestMessage()
3333
}
3434
catch (PythonException e)
3535
{
36-
Assert.AreEqual("exceptions.IndexError : list index out of range", e.Message);
36+
Assert.AreEqual("IndexError : list index out of range", e.Message);
3737
}
3838
}
3939

‎pythonnet/src/runtime/pythonexception.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public PythonException() : base()
3434
IntPtr gs = PythonEngine.AcquireLock();
3535
if ((_pyType != IntPtr.Zero) && (_pyValue != IntPtr.Zero))
3636
{
37-
string type = new PyObject(_pyType).ToString();
37+
string type = new PyObject(_pyType).GetAttr("__name__").ToString();
3838
string message = Runtime.GetManagedString(_pyValue);
3939
_message = type + " : " + message;
4040
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL