From dd41fccba6387148b9a5d044adbe840dd400f53a Mon Sep 17 00:00:00 2001 From: Victor Nova Date: Mon, 27 Sep 2021 15:53:20 -0700 Subject: [PATCH] fixup! Disable implicit conversions, that might lose information: fixes for https://github.com/pythonnet/pythonnet/pull/1568 --- src/runtime/converter.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/runtime/converter.cs b/src/runtime/converter.cs index 6bcf3fb59..ba04933f7 100644 --- a/src/runtime/converter.cs +++ b/src/runtime/converter.cs @@ -361,6 +361,12 @@ internal static bool ToManagedValue(IntPtr value, Type obType, } result = cb.type.Value; return true; + + case null: + break; + + default: + throw new ArgumentException("We should never receive instances of other managed types"); } if (value == Runtime.PyNone && !obType.IsValueType) @@ -513,7 +519,7 @@ internal static bool ToManagedValue(IntPtr value, Type obType, { if (setError) { - Exceptions.SetError(ex.InnerException); + Exceptions.SetError(ex); } return null; }