@@ -1416,6 +1416,7 @@ Object execute(Object[] arguments,
1416
1416
@ Cached HPyAsHandleNode asHandleNode ,
1417
1417
@ Cached CastToJavaLongExactNode castToJavaLongNode ,
1418
1418
@ Cached GetByteArrayNode getByteArrayNode ,
1419
+ @ Cached TruffleString .FromJavaStringNode fromJavaStringNode ,
1419
1420
@ Exclusive @ Cached GilNode gil ) throws ArityException {
1420
1421
boolean mustRelease = gil .acquire ();
1421
1422
try {
@@ -1432,7 +1433,7 @@ Object execute(Object[] arguments,
1432
1433
} catch (OverflowException | InteropException ex ) {
1433
1434
throw CompilerDirectives .shouldNotReachHere (ex );
1434
1435
}
1435
- String result = decode (CodingErrorAction .IGNORE , bytes );
1436
+ TruffleString result = fromJavaStringNode . execute ( decode (CodingErrorAction .IGNORE , bytes ), TS_ENCODING );
1436
1437
return asHandleNode .execute (context , result );
1437
1438
} finally {
1438
1439
gil .release (mustRelease );
@@ -1472,6 +1473,7 @@ Object execute(Object[] arguments,
1472
1473
@ Cached HPyAsHandleNode asHandleNode ,
1473
1474
@ Cached CastToJavaLongExactNode castToJavaLongNode ,
1474
1475
@ Cached CastToTruffleStringNode castToJavaStringNode ,
1476
+ @ Cached TruffleString .FromJavaStringNode fromJavaStringNode ,
1475
1477
@ Cached GetByteArrayNode getByteArrayNode ,
1476
1478
@ Cached HPyRaiseNode raiseNode ,
1477
1479
@ Cached TruffleString .EqualNode equalNode ,
@@ -1495,7 +1497,7 @@ Object execute(Object[] arguments,
1495
1497
// short-circuit the error reading etc
1496
1498
TruffleString errors = castToJavaStringNode .execute (callHPyFunction .call (context , GraalHPyNativeSymbol .POLYGLOT_FROM_STRING , arguments [3 ], "ascii" ));
1497
1499
CodingErrorAction errorAction = CodecsModuleBuiltins .convertCodingErrorAction (errors , equalNode );
1498
- String result = decode (errorAction , bytes );
1500
+ TruffleString result = fromJavaStringNode . execute ( decode (errorAction , bytes ), TS_ENCODING );
1499
1501
if (result == null ) {
1500
1502
// TODO: refactor helper nodes for CodecsModuleBuiltins to use them here
1501
1503
return raiseNode .raiseWithoutFrame (context , GraalHPyHandle .NULL_HANDLE , PythonBuiltinClassType .UnicodeDecodeError , ErrorMessages .MALFORMED_INPUT );
0 commit comments