Skip to content

Commit 42bc60e

Browse files
committed
BuiltinConstructors:module - check if self is really a class
1 parent 1160051 commit 42bc60e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
import com.oracle.graal.python.builtins.objects.type.TypeNodes;
133133
import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetMroNode;
134134
import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetNameNode;
135+
import com.oracle.graal.python.builtins.objects.type.TypeNodes.IsTypeNode;
135136
import com.oracle.graal.python.nodes.BuiltinNames;
136137
import com.oracle.graal.python.nodes.PGuards;
137138
import com.oracle.graal.python.nodes.PNodeWithGlobalState.DefaultContextManager;
@@ -2413,9 +2414,10 @@ Object doType(PythonBuiltinClassType self, Object[] varargs, PKeyword[] kwargs)
24132414
return factory().createPythonModule(self);
24142415
}
24152416

2416-
@Specialization
2417+
@Specialization(guards = "isTypeNode.execute(self)")
24172418
@SuppressWarnings("unused")
2418-
Object doNative(PythonAbstractNativeObject self, Object[] varargs, PKeyword[] kwargs) {
2419+
Object doNative(PythonAbstractNativeObject self, Object[] varargs, PKeyword[] kwargs,
2420+
@Cached IsTypeNode isTypeNode) {
24192421
return factory().createPythonModule(self);
24202422
}
24212423
}

0 commit comments

Comments
 (0)