Skip to content

Commit b94882c

Browse files
committed
direct object instances do not have a __dict__ attribute
1 parent 746982a commit b94882c

File tree

1 file changed

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

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,11 @@ Object dict(@SuppressWarnings("unused") PythonClass self) {
483483
throw new AssertionError();
484484
}
485485

486-
@Specialization(guards = {"!isBuiltinObject(self)", "!isClass(self)"})
486+
protected boolean isExactObjectInstance(PythonObject self) {
487+
return lookupClass(PythonBuiltinClassType.PythonObject) == self.getPythonClass();
488+
}
489+
490+
@Specialization(guards = {"!isBuiltinObject(self)", "!isClass(self)", "!isExactObjectInstance(self)"})
487491
Object dict(PythonObject self) {
488492
PHashingCollection dict = self.getDict();
489493
if (dict == null) {

0 commit comments

Comments
 (0)