|
73 | 73 | import com.oracle.graal.python.builtins.Python3Core; |
74 | 74 | import com.oracle.graal.python.builtins.PythonBuiltinClassType; |
75 | 75 | import com.oracle.graal.python.builtins.modules.CodecsModuleBuiltins; |
| 76 | +import com.oracle.graal.python.builtins.modules.SysModuleBuiltins; |
76 | 77 | import com.oracle.graal.python.builtins.modules.SysModuleBuiltins.GetFileSystemEncodingNode; |
77 | 78 | import com.oracle.graal.python.builtins.modules.WarningsModuleBuiltins.WarnNode; |
78 | 79 | import com.oracle.graal.python.builtins.objects.PNone; |
@@ -1264,7 +1265,8 @@ public static GraalHPyUnicodeAsCharsetString asLatin1() { |
1264 | 1265 |
|
1265 | 1266 | @TruffleBoundary |
1266 | 1267 | public static GraalHPyUnicodeAsCharsetString asFSDefault() { |
1267 | | - return new GraalHPyUnicodeAsCharsetString(CharsetMapping.getCharsetNormalized(GetFileSystemEncodingNode.getFileSystemEncoding())); |
| 1268 | + TruffleString normalizedEncoding = CharsetMapping.normalizeUncached(GetFileSystemEncodingNode.getFileSystemEncoding()); |
| 1269 | + return new GraalHPyUnicodeAsCharsetString(CharsetMapping.getCharsetNormalized(normalizedEncoding)); |
1268 | 1270 | } |
1269 | 1271 | } |
1270 | 1272 |
|
@@ -1447,7 +1449,8 @@ public static GraalHPyUnicodeDecodeCharsetAndSize decodeFSDefault() { |
1447 | 1449 | @TruffleBoundary |
1448 | 1450 | private String decode(CodingErrorAction errorAction, byte[] bytes) { |
1449 | 1451 | try { |
1450 | | - return CharsetMapping.getCharsetNormalized(charset).newDecoder().onMalformedInput(errorAction).onUnmappableCharacter(errorAction).decode(ByteBuffer.wrap(bytes)).toString(); |
| 1452 | + TruffleString normalizedCharset = CharsetMapping.normalizeUncached(charset); |
| 1453 | + return CharsetMapping.getCharsetNormalized(normalizedCharset).newDecoder().onMalformedInput(errorAction).onUnmappableCharacter(errorAction).decode(ByteBuffer.wrap(bytes)).toString(); |
1451 | 1454 | } catch (CharacterCodingException ex) { |
1452 | 1455 | throw CompilerDirectives.shouldNotReachHere(ex); |
1453 | 1456 | } |
@@ -1520,7 +1523,8 @@ public static GraalHPyUnicodeDecodeCharsetAndSizeAndErrors decodeLatin1() { |
1520 | 1523 | @TruffleBoundary |
1521 | 1524 | private String decode(CodingErrorAction errorAction, byte[] bytes) { |
1522 | 1525 | try { |
1523 | | - return CharsetMapping.getCharsetNormalized(charset).newDecoder().onMalformedInput(errorAction).onUnmappableCharacter(errorAction).decode(ByteBuffer.wrap(bytes)).toString(); |
| 1526 | + TruffleString normalizedCharset = CharsetMapping.normalizeUncached(charset); |
| 1527 | + return CharsetMapping.getCharsetNormalized(normalizedCharset).newDecoder().onMalformedInput(errorAction).onUnmappableCharacter(errorAction).decode(ByteBuffer.wrap(bytes)).toString(); |
1524 | 1528 | } catch (CharacterCodingException ex) { |
1525 | 1529 | return null; |
1526 | 1530 | } |
|
0 commit comments