Skip to content

Commit 780829c

Browse files
committed
Update refcount assertsion now that we don't have stealing in managed
1 parent 3f90982 commit 780829c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/PythonNativeWrapper.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ public void incRef() {
228228
if (refCount != IMMORTAL_REFCNT) {
229229
CApiTransitions.writeNativeRefCount(pointer, refCount + 1);
230230
}
231-
// "-1" because the refcount can briefly go below (e.g., PyTuple_SetItem)
232-
assert refCount >= (PythonAbstractObjectNativeWrapper.MANAGED_REFCNT - 1) : "invalid refcnt " + refCount + " during incRef in " + Long.toHexString(getNativePointer());
231+
assert refCount >= PythonAbstractObjectNativeWrapper.MANAGED_REFCNT : "invalid refcnt " + refCount + " during incRef in " + Long.toHexString(getNativePointer());
233232
}
234233

235234
@TruffleBoundary(allowInlining = true)
@@ -239,8 +238,7 @@ public long decRef() {
239238
if (refCount != IMMORTAL_REFCNT) {
240239
long updatedRefCount = refCount - 1;
241240
CApiTransitions.writeNativeRefCount(pointer, updatedRefCount);
242-
// "-1" because the refcount can briefly go below (e.g., PyTuple_SetItem)
243-
assert updatedRefCount >= (PythonAbstractObjectNativeWrapper.MANAGED_REFCNT - 1) : "invalid refcnt " + updatedRefCount + " during decRef in " + Long.toHexString(getNativePointer());
241+
assert updatedRefCount >= PythonAbstractObjectNativeWrapper.MANAGED_REFCNT : "invalid refcnt " + updatedRefCount + " during decRef in " + Long.toHexString(getNativePointer());
244242
if (updatedRefCount == PythonAbstractObjectNativeWrapper.MANAGED_REFCNT && ref != null) {
245243
// make weak
246244
assert ref.isStrongReference();

0 commit comments

Comments
 (0)