|
135 | 135 | import com.oracle.graal.python.lib.PyNumberAsSizeNode;
|
136 | 136 | import com.oracle.graal.python.lib.PyObjectGetItem;
|
137 | 137 | import com.oracle.graal.python.lib.PyObjectHashNode;
|
| 138 | +import com.oracle.graal.python.lib.PyUnicodeCheckNode; |
138 | 139 | import com.oracle.graal.python.nodes.ErrorMessages;
|
139 | 140 | import com.oracle.graal.python.nodes.PGuards;
|
140 | 141 | import com.oracle.graal.python.nodes.PRaiseNode;
|
@@ -515,15 +516,25 @@ abstract static class RichCompareNode extends PythonTernaryBuiltinNode {
|
515 | 516 | @Specialization(guards = "isEqualityOpCode(opCode)")
|
516 | 517 | static Object doEqNeOp(Object left, Object right, int opCode,
|
517 | 518 | @Bind("this") Node inliningTarget,
|
| 519 | + @Exclusive @Cached PyUnicodeCheckNode checkLeft, |
| 520 | + @Exclusive @Cached PyUnicodeCheckNode checkRight, |
518 | 521 | @Cached StringEqOpHelperNode stringEqOpHelperNode) {
|
| 522 | + if (!checkLeft.execute(inliningTarget, left) || !checkRight.execute(inliningTarget, right)) { |
| 523 | + return PNotImplemented.NOT_IMPLEMENTED; |
| 524 | + } |
519 | 525 | return stringEqOpHelperNode.execute(inliningTarget, left, right, opCode == ComparisonOp.NE.opCode);
|
520 | 526 | }
|
521 | 527 |
|
522 | 528 | @Specialization(guards = {"opCode == cachedOp.opCode", "!isEqualityOpCode(opCode)"}, limit = "4")
|
523 | 529 | static Object doRelOp(Object left, Object right, @SuppressWarnings("unused") int opCode,
|
524 | 530 | @Bind("this") Node inliningTarget,
|
| 531 | + @Exclusive @Cached PyUnicodeCheckNode checkLeft, |
| 532 | + @Exclusive @Cached PyUnicodeCheckNode checkRight, |
525 | 533 | @Cached("fromOpCode(opCode)") ComparisonOp cachedOp,
|
526 | 534 | @Cached StringCmpOpHelperNode stringCmpOpHelperNode) {
|
| 535 | + if (!checkLeft.execute(inliningTarget, left) || !checkRight.execute(inliningTarget, right)) { |
| 536 | + return PNotImplemented.NOT_IMPLEMENTED; |
| 537 | + } |
527 | 538 | return stringCmpOpHelperNode.execute(inliningTarget, left, right, cachedOp.intPredicate);
|
528 | 539 | }
|
529 | 540 | }
|
|
0 commit comments