Skip to content

Commit d80a8b9

Browse files
committed
Increase ref-count as documented for PyErr_Restore
1 parent dd5e2b6 commit d80a8b9

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
@@ -256,6 +256,9 @@ public static void SetError(Exception e)
256256
var pe = e as PythonException;
257257
if (pe != null)
258258
{
259+
Runtime.XIncref(pe.PyType);
260+
Runtime.XIncref(pe.PyValue);
261+
Runtime.XIncref(pe.PyTB);
259262
Runtime.PyErr_Restore(pe.PyType, pe.PyValue, pe.PyTB);
260263
return;
261264
}

0 commit comments

Comments
 (0)