Skip to content
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
Use PythonException.Restore
  • Loading branch information
tminka committed Jan 5, 2021
commit 0a88f27fa19959a6cf0c7f0ca43e5c1720839a39
3 changes: 1 addition & 2 deletions src/runtime/importhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
}
// Save the exception
var originalException = new PythonException();
var originalExceptionMessage = originalException.ToString();
// Otherwise, just clear the it.
Exceptions.Clear();

Expand Down Expand Up @@ -345,7 +344,7 @@ public static IntPtr __import__(IntPtr self, IntPtr args, IntPtr kw)
ManagedType mt = tail.GetAttribute(name, true);
if (!(mt is ModuleObject))
{
Exceptions.SetError(Exceptions.ImportError, originalExceptionMessage);
originalException.Restore();
return IntPtr.Zero;
}
if (head == null)
Expand Down