Skip to content

Commit dfa72c1

Browse files
committed
Fix: Check if '__call__' exists to avoid endless recursion.
1 parent 5ca7993 commit dfa72c1

File tree

1 file changed

+6
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/call

1 file changed

+6
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/call/CallNode.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
*/
4141
package com.oracle.graal.python.nodes.call;
4242

43+
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
44+
import com.oracle.graal.python.builtins.objects.PNone;
4345
import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction;
4446
import com.oracle.graal.python.builtins.objects.function.PFunction;
4547
import com.oracle.graal.python.builtins.objects.function.PKeyword;
@@ -81,6 +83,10 @@ protected Object specialCall(VirtualFrame frame, Object callableObject, Object[]
8183
@Cached("create(__CALL__)") LookupInheritedAttributeNode callAttrGetterNode,
8284
@Cached("create()") CallVarargsMethodNode callCallNode) {
8385
Object call = callAttrGetterNode.execute(callableObject);
86+
if (call == PNone.NO_VALUE) {
87+
CompilerDirectives.transferToInterpreter();
88+
throw raise(PythonBuiltinClassType.TypeError, "'%p' object is not callable", callableObject);
89+
}
8490
return callCallNode.execute(frame, call, PositionalArgumentsNode.prependArgument(callableObject, arguments, arguments.length), keywords);
8591
}
8692

0 commit comments

Comments
 (0)