Skip to content

Commit 9c35c5d

Browse files
committed
Fix special method slot invalidation in case of PNone.NO_VALUE
1 parent 41d2731 commit 9c35c5d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,13 +520,14 @@ private static void fixupSpecialMethodSlot(PythonManagedClass klass, SpecialMeth
520520
Object value = ReadAttributeFromObjectNode.getUncachedForceType().execute(kls, slot.getName());
521521
if (value != PNone.NO_VALUE) {
522522
currentNewValue = value;
523-
slot.setValue(klass, value);
524523
break;
525524
}
526525
}
527-
assert newValue == null || newValue == PNone.NO_VALUE || slot.getValue(klass) != PNone.NO_VALUE;
526+
// If we did not find it at all, it is OK as long as the new value is NO_VALUE
527+
assert newValue == PNone.NO_VALUE || currentNewValue != PNone.NO_VALUE;
528528
if (currentOldValue != currentNewValue) {
529529
// Something actually changed, fixup subclasses...
530+
slot.setValue(klass, currentNewValue);
530531
fixupSpecialMethodInSubClasses(klass.getSubClasses(), slot, originalValue, newValue);
531532
} else {
532533
// We assume no other changes in MRO, so we must have either overridden the slot with

0 commit comments

Comments
 (0)