Skip to content

Commit fee1226

Browse files
committed
Fix supercheck instance check
1 parent ef01f93 commit fee1226

File tree

1 file changed

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

1 file changed

+3
-12
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/superobject/SuperBuiltins.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import com.oracle.graal.python.builtins.CoreFunctions;
4848
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
4949
import com.oracle.graal.python.builtins.PythonBuiltins;
50-
import com.oracle.graal.python.builtins.modules.BuiltinFunctions.IsInstanceNode;
5150
import com.oracle.graal.python.builtins.objects.PNone;
5251
import com.oracle.graal.python.builtins.objects.cell.CellBuiltins;
5352
import com.oracle.graal.python.builtins.objects.cell.PCell;
@@ -173,7 +172,6 @@ static Object uncached(SuperObject self) {
173172
@GenerateNodeFactory
174173
public abstract static class SuperInitNode extends PythonVarargsBuiltinNode {
175174
@Child private IsSubtypeNode isSubtypeNode;
176-
@Child private IsInstanceNode isInstanceNode;
177175
@Child private GetClassNode getClassNode;
178176
@Child private LookupAndCallBinaryNode getAttrNode;
179177
@Child private CellBuiltins.GetRefNode getRefNode;
@@ -324,14 +322,6 @@ private IsSubtypeNode getIsSubtype() {
324322
return isSubtypeNode;
325323
}
326324

327-
private IsInstanceNode getIsInstance() {
328-
if (isInstanceNode == null) {
329-
CompilerDirectives.transferToInterpreterAndInvalidate();
330-
isInstanceNode = insert(IsInstanceNode.create());
331-
}
332-
return isInstanceNode;
333-
}
334-
335325
private GetClassNode getGetClass() {
336326
if (getClassNode == null) {
337327
CompilerDirectives.transferToInterpreterAndInvalidate();
@@ -378,8 +368,9 @@ private Object supercheck(VirtualFrame frame, Object cls, Object object) {
378368
}
379369
}
380370

381-
if (getIsInstance().executeWith(frame, object, cls)) {
382-
return getGetClass().execute(object);
371+
Object objectType = getGetClass().execute(object);
372+
if (getIsSubtype().execute(frame, objectType, cls)) {
373+
return objectType;
383374
} else {
384375
try {
385376
Object classObject = getGetAttr().executeObject(frame, object, SpecialAttributeNames.__CLASS__);

0 commit comments

Comments
 (0)