Skip to content

Commit b919d82

Browse files
committed
Use format string if error message format is invalid
1 parent c52f215 commit b919d82

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/exception/BaseExceptionBuiltins.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ private String getFormattedMessage(PythonObjectLibrary lib, String format, Objec
117117
}
118118
return String.format(format, args);
119119
} catch (IllegalFormatException e) {
120-
throw new RuntimeException("error while formatting \"" + format + "\"", e);
120+
// According to PyUnicode_FromFormat, invalid format specifiers are just ignored.
121+
return format;
121122
}
122123
}
123124

0 commit comments

Comments
 (0)