8000 fixed __cause__ on constructor overload bind failure · pythonnet/pythonnet@3808c3d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3808c3d

Browse files
committed
fixed __cause__ on constructor overload bind failure
1 parent 0a89e6f commit 3808c3d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/runtime/constructorbinder.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ internal object InvokeRaw(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info)
107107
}
108108

109109
errorMessage.Append(": ");
110+
Runtime.PyErr_Fetch(out var errType, out var errVal, out var errTrace);
110111
AppendArgumentTypes(to: errorMessage, args);
111-
Exceptions.SetError(Exceptions.TypeError, errorMessage.ToString());
112+
Runtime.PyErr_Restore(errType.StealNullable(), errVal.StealNullable(), errTrace.StealNullable());
113+
Exceptions.RaiseTypeError(errorMessage.ToString());
112114
return null;
113115
}
114116
}

0 commit comments

Comments
 (0)
0