Skip to content

Commit 9153a89

Browse files
committed
Fix weaklist presence check
1 parent 14200a0 commit 9153a89

File tree

1 file changed

+8
-8
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type

1 file changed

+8
-8
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/TypeNodes.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,16 +1275,16 @@ public static boolean executeUncached(Object type) {
12751275
return InstancesOfTypeHaveWeakrefsNodeGen.getUncached().execute(null, type);
12761276
}
12771277

1278-
@Specialization(guards = "!isNativeObject(type)")
1279-
static boolean doManaged(Object type,
1280-
@Cached(inline = false) ReadAttributeFromObjectNode read) {
1281-
return read.execute(type, T___WEAKREF__) != PNone.NO_VALUE;
1282-
}
1283-
12841278
@Specialization
1285-
static boolean doNative(Node inliningTarget, PythonAbstractNativeObject type,
1279+
static boolean check(Node inliningTarget, Object type,
1280+
@Cached NeedsNativeAllocationNode needsNativeAllocationNode,
1281+
@Cached(inline = false) ReadAttributeFromObjectNode read,
12861282
@Cached GetWeakListOffsetNode getWeakListOffsetNode) {
1287-
return getWeakListOffsetNode.execute(inliningTarget, type) != 0;
1283+
if (needsNativeAllocationNode.execute(inliningTarget, type)) {
1284+
return getWeakListOffsetNode.execute(inliningTarget, type) != 0;
1285+
} else {
1286+
return read.execute(type, T___WEAKREF__) != PNone.NO_VALUE;
1287+
}
12881288
}
12891289
}
12901290

0 commit comments

Comments
 (0)