Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e456a54

Browse files
committed
fixed ConversionsObject test failing due to sequence to array conversion taking priority
1 parent 5d9f83d commit e456a54

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/runtime/converter.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,13 @@ internal static bool ToManagedValue(IntPtr value, Type obType,
385385
return ToPrimitive(value, doubleType, out result, setError);
386386
}
387387

388+
// give custom codecs a chance to take over conversion of sequences
389+
IntPtr pyType = Runtime.PyObject_TYPE(value);
390+
if (PyObjectConversions.TryDecode(value, pyType, obType, out result))
391+
{
392+
return true;
393+
}
394+
388395
if (Runtime.PySequence_Check(value))
389396
{
390397
return ToArray(value, typeof(object[]), out result, setError);

0 commit comments

Comments
 (0)