Skip to content

Commit f068ec4

Browse files
committed
Fix error type for invalid format character
1 parent dea734c commit f068ec4

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
import java.util.regex.Matcher;
7676
import java.util.regex.Pattern;
7777

78-
import com.oracle.truffle.api.dsl.Fallback;
7978
import org.graalvm.shadowed.com.ibm.icu.lang.UCharacter;
8079
import org.graalvm.shadowed.com.ibm.icu.lang.UProperty;
8180
import org.graalvm.shadowed.com.ibm.icu.text.CaseMap;
@@ -179,6 +178,7 @@
179178
import com.oracle.truffle.api.dsl.Cached;
180179
import com.oracle.truffle.api.dsl.Cached.Exclusive;
181180
import com.oracle.truffle.api.dsl.Cached.Shared;
181+
import com.oracle.truffle.api.dsl.Fallback;
182182
import com.oracle.truffle.api.dsl.GenerateCached;
183183
import com.oracle.truffle.api.dsl.GenerateInline;
184184
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
@@ -263,7 +263,7 @@ private static TruffleString formatString(Node raisingNode, Spec spec, String st
263263
private static Spec getAndValidateSpec(Node inliningTarget, TruffleString formatString, PRaiseNode.Lazy raiseNode) {
264264
Spec spec = InternalFormat.fromText(formatString, 's', '<', inliningTarget);
265265
if (Spec.specified(spec.type) && spec.type != 's') {
266-
throw raiseNode.get(inliningTarget).raise(TypeError, ErrorMessages.UNKNOWN_FORMAT_CODE, spec.type, "str");
266+
throw raiseNode.get(inliningTarget).raise(ValueError, ErrorMessages.UNKNOWN_FORMAT_CODE, spec.type, "str");
267267
}
268268
if (Spec.specified(spec.sign)) {
269269
if (spec.sign == ' ') {

0 commit comments

Comments
 (0)