Skip to content

Commit 667ab67

Browse files
committed
SuperBuiltins.SuperInitNode.getClassFromTarget discard wrong check for __class__ as cell. Handle corner case when the __class__ is deleted
1 parent 4a9248b commit 667ab67

File tree

1 file changed

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

1 file changed

+5
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@
8181
import com.oracle.graal.python.builtins.objects.type.TypeNodes.IsSameTypeNode;
8282
import com.oracle.graal.python.builtins.objects.type.TypeNodesFactory.IsSameTypeNodeGen;
8383
import com.oracle.graal.python.nodes.ErrorMessages;
84-
import com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode;
8584
import com.oracle.graal.python.nodes.PNodeWithContext;
8685
import com.oracle.graal.python.nodes.SpecialAttributeNames;
8786
import com.oracle.graal.python.nodes.argument.ReadIndexedArgumentNode;
8887
import com.oracle.graal.python.nodes.attributes.LookupInheritedSlotNode;
8988
import com.oracle.graal.python.nodes.attributes.ReadAttributeFromObjectNode;
89+
import com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode;
9090
import com.oracle.graal.python.nodes.call.special.CallTernaryMethodNode;
9191
import com.oracle.graal.python.nodes.call.special.LookupAndCallBinaryNode;
9292
import com.oracle.graal.python.nodes.classes.IsSubtypeNode;
@@ -323,14 +323,11 @@ private Object getClassFromTarget(VirtualFrame frame, PFrame target, HashingStor
323323
// sys._getframe(1).f_code.co_closure?
324324
PDict locals = (PDict) target.getLocalsDict();
325325
Object cls = hlib.getItemWithState(locals.getDictStorage(), SpecialAttributeNames.T___CLASS__, PArguments.getThreadState(frame));
326-
if (cls instanceof PCell) {
327-
cls = getGetRefNode().execute((PCell) cls);
328-
if (cls == null) {
329-
// the cell is empty
330-
throw raise(PythonErrorType.RuntimeError, ErrorMessages.SUPER_EMPTY_CLASS);
331-
}
326+
if (cls == null) {
327+
// the cell is empty
328+
throw raise(PythonErrorType.RuntimeError, ErrorMessages.SUPER_EMPTY_CLASS);
332329
}
333-
return cls != null ? cls : PNone.NONE;
330+
return cls;
334331
}
335332

336333
private CellBuiltins.GetRefNode getGetRefNode() {

0 commit comments

Comments
 (0)