8000 fixed tuple codec not clearing Python exception after unsuccessful el… · sdpython/pythonnet@a320d49 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 22, 2023. It is now read-only.

Commit a320d49

Browse files
authored
fixed tuple codec not clearing Python exception after unsuccessful element decoding attempt (pythonnet#1083)
1 parent 925c166 commit a320d49
< 8000 div class="prc-PageLayout-HorizontalDivider-CYLp5 prc-PageLayout-PaneHorizontalDivider-4exOb" data-variant="none" data-position="start" style="--spacing-divider:var(--spacing-none);--spacing:var(--spacing-none)">

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/Codecs/TupleCodecs.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public bool TryDecode<T>(PyObject pyObj, out T value)
8181
IntPtr pyItem = Runtime.PyTuple_GetItem(pyObj.Handle, itemIndex);
8282
if (!Converter.ToManaged(pyItem, itemTypes[itemIndex], out elements[itemIndex], setError: false))
8383
{
84+
Exceptions.Clear();
8485
return false;
8586
}
8687
}
@@ -105,6 +106,7 @@ static bool Decode(PyObject tuple, out object value)
105106
var pyItem = Runtime.PyTuple_GetItem(tuple.Handle, itemIndex);
106107
if (!Converter.ToManaged(pyItem, typeof(object), out elements[itemIndex], setError: false))
107108
{
109+
Exceptions.Clear();
108110
return false;
109111
}
110112

0 commit comments

Comments
 (0)
0