Skip to content

Commit d068f36

Browse files
committed
XDecref now checks, that refcount is positive in debug builds
1 parent e79f041 commit d068f36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/runtime/runtime.cs

+3
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,9 @@ internal static IntPtr SelfIncRef(IntPtr op)
714714

715715
internal static unsafe void XDecref(IntPtr op)
716716
{
717+
#if DEBUG
718+
Debug.Assert(op == IntPtr.Zero || Refcount(op) > 0);
719+
#endif
717720
#if !CUSTOM_INCDEC_REF
718721
Py_DecRef(op);
719722
return;

0 commit comments

Comments
 (0)