Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4877fe7

Browse files
committed
fixed __cause__ on overload bind failure and array conversion
1 parentd068f36 commit4877fe7

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

‎src/runtime/converter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,14 @@ private static bool ToPrimitive(IntPtr value, Type obType, out object result, bo
817817

818818
privatestaticvoidSetConversionError(IntPtrvalue,Typetarget)
819819
{
820+
// PyObject_Repr might clear the error
821+
Runtime.PyErr_Fetch(outvarcauseType,outvarcauseVal,outvarcauseTrace);
822+
820823
IntPtrob=Runtime.PyObject_Repr(value);
821824
stringsrc=Runtime.GetManagedString(ob);
822825
Runtime.XDecref(ob);
826+
827+
Runtime.PyErr_Restore(causeType.StealNullable(),causeVal.StealNullable(),causeTrace.StealNullable());
823828
Exceptions.RaiseTypeError($"Cannot convert{src} to{target}");
824829
}
825830

‎src/runtime/methodbinder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,9 @@ internal virtual IntPtr Invoke(IntPtr inst, IntPtr args, IntPtr kw, MethodBase i
926926
}
927927

928928
value.Append(": ");
929+
Runtime.PyErr_Fetch(outvarerrType,outvarerrVal,outvarerrTrace);
929930
AppendArgumentTypes(to:value,args);
931+
Runtime.PyErr_Restore(errType.StealNullable(),errVal.StealNullable(),errTrace.StealNullable());
930932
Exceptions.RaiseTypeError(value.ToString());
931933
returnIntPtr.Zero;
932934
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp