Skip to content

Commit 44272dc

Browse files
committed
properly return NotImplemented in str.__add__
1 parent 0c291dc commit 44272dc

File tree

1 file changed

+4
-4
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str

1 file changed

+4
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str/StringBuiltins.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,13 @@ private static String stringConcat(CharSequence left, CharSequence right) {
404404
}
405405

406406
@Specialization(guards = "!isString(other)")
407-
String doSO(@SuppressWarnings("unused") String self, Object other) {
408-
throw raise(TypeError, "Can't convert '%p' object to str implicitly", other);
407+
PNotImplemented doSO(@SuppressWarnings("unused") String self, @SuppressWarnings("unused") Object other) {
408+
return PNotImplemented.NOT_IMPLEMENTED;
409409
}
410410

411411
@Specialization(guards = "!isString(other)")
412-
String doSO(@SuppressWarnings("unused") PString self, Object other) {
413-
throw raise(TypeError, "Can't convert '%p' object to str implicitly", other);
412+
PNotImplemented doSO(@SuppressWarnings("unused") PString self, @SuppressWarnings("unused") Object other) {
413+
return PNotImplemented.NOT_IMPLEMENTED;
414414
}
415415

416416
@SuppressWarnings("unused")

0 commit comments

Comments
 (0)