Skip to content

Commit 6810504

Browse files
committed
fix invalid class sharing across contexts
1 parent 19591ea commit 6810504

File tree

1 file changed

+6
-3
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object

1 file changed

+6
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/PythonObject.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,16 @@ public static boolean hasInitialClass(PythonObject self, DynamicObjectLibrary dy
9191
return (dylib.getShapeFlags(self) & CLASS_CHANGED_FLAG) == 0;
9292
}
9393

94+
public static Object getInitialClass(PythonObject self) {
95+
return self.initialPythonClass;
96+
}
97+
9498
@SuppressWarnings("unused")
95-
@Specialization(guards = {"klass != null", "self.getShape() == cachedShape", "hasInitialClass"}, limit = "1")
99+
@Specialization(guards = {"klass != null", "self.getShape() == cachedShape", "hasInitialClass(self, dylib)"}, limit = "1", assumptions = "singleContextAssumption()")
96100
public static Object getConstantClass(PythonObject self,
97101
@Shared("dylib") @CachedLibrary(limit = "4") DynamicObjectLibrary dylib,
98-
@Cached("hasInitialClass(self, dylib)") boolean hasInitialClass,
99102
@Cached("self.getShape()") Shape cachedShape,
100-
@Cached("getPythonClass(self, dylib)") Object klass) {
103+
@Cached(value = "getInitialClass(self)", weak = true) Object klass) {
101104
return klass;
102105
}
103106

0 commit comments

Comments
 (0)