Skip to content

Commit a8e3d96

Browse files
filmormanako-t
authored andcommitted
Increase ref-count as documented for PyErr_Restore
1 parent ec725d8 commit a8e3d96

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/runtime/exceptions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ public static void SetError(Exception e)
269269
PythonException pe = e as PythonException;
270270
if (pe != null)
271271
{
272+
Runtime.XIncref(pe.PyType);
273+
Runtime.XIncref(pe.PyValue);
274+
Runtime.XIncref(pe.PyTB);
272275
Runtime.PyErr_Restore(pe.PyType, pe.PyValue, pe.PyTB);
273276
return;
274277
}

0 commit comments

Comments
 (0)