|
40 | 40 | */
|
41 | 41 | package com.oracle.graal.python.lib;
|
42 | 42 |
|
| 43 | +import static com.oracle.graal.python.nodes.BuiltinNames.T_PRINT; |
| 44 | +import static com.oracle.graal.python.util.PythonUtils.TS_ENCODING; |
| 45 | + |
43 | 46 | import com.oracle.graal.python.builtins.PythonBuiltinClassType;
|
44 | 47 | import com.oracle.graal.python.builtins.objects.PNotImplemented;
|
| 48 | +import com.oracle.graal.python.builtins.objects.method.PBuiltinMethod; |
45 | 49 | import com.oracle.graal.python.builtins.objects.type.TpSlots.GetCachedTpSlotsNode;
|
46 | 50 | import com.oracle.graal.python.builtins.objects.type.slots.TpSlot;
|
47 | 51 | import com.oracle.graal.python.builtins.objects.type.slots.TpSlotBinaryOp.BinaryOpSlot;
|
48 | 52 | import com.oracle.graal.python.nodes.ErrorMessages;
|
| 53 | +import com.oracle.graal.python.nodes.PRaiseNode; |
49 | 54 | import com.oracle.graal.python.nodes.PRaiseNode.Lazy;
|
50 | 55 | import com.oracle.graal.python.nodes.expression.BinaryOpNode;
|
51 | 56 | import com.oracle.graal.python.nodes.object.GetClassNode;
|
52 | 57 | import com.oracle.graal.python.runtime.exception.PException;
|
| 58 | +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; |
53 | 59 | import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
|
54 | 60 | import com.oracle.truffle.api.dsl.Cached;
|
55 | 61 | import com.oracle.truffle.api.dsl.Fallback;
|
@@ -108,9 +114,19 @@ static Object doIt(VirtualFrame frame, Node inliningTarget, Object v, Object w,
|
108 | 114 |
|
109 | 115 | @InliningCutoff
|
110 | 116 | private static PException raiseNotSupported(Node inliningTarget, Object v, Object w, Lazy raiseNode) {
|
| 117 | + if (v instanceof PBuiltinMethod) { |
| 118 | + handlePossiblePrint(inliningTarget, v, w); |
| 119 | + } |
111 | 120 | return raiseNode.get(inliningTarget).raise(PythonBuiltinClassType.TypeError, ErrorMessages.UNSUPPORTED_OPERAND_TYPES_FOR_S_P_AND_P, ">>", v, w);
|
112 | 121 | }
|
113 | 122 |
|
| 123 | + @TruffleBoundary |
| 124 | + private static void handlePossiblePrint(Node inliningTarget, Object v, Object w) { |
| 125 | + if (v instanceof PBuiltinMethod method && method.getBuiltinFunction().getName().equalsUncached(T_PRINT, TS_ENCODING)) { |
| 126 | + throw PRaiseNode.raiseUncached(inliningTarget, PythonBuiltinClassType.TypeError, ErrorMessages.UNSUPPORTED_OPERAND_TYPES_FOR_S_P_AND_P_PRINT, ">>", v, w); |
| 127 | + } |
| 128 | + } |
| 129 | + |
114 | 130 | @NeverDefault
|
115 | 131 | public static PyNumberRshiftNode create() {
|
116 | 132 | return PyNumberRshiftNodeGen.create();
|
|
0 commit comments