|
73 | 73 | import com.oracle.truffle.api.CompilerDirectives;
|
74 | 74 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
75 | 75 | import com.oracle.truffle.api.dsl.Cached;
|
| 76 | +import com.oracle.truffle.api.dsl.Cached.Shared; |
76 | 77 | import com.oracle.truffle.api.dsl.Fallback;
|
77 | 78 | import com.oracle.truffle.api.dsl.GenerateNodeFactory;
|
78 | 79 | import com.oracle.truffle.api.dsl.ImportStatic;
|
@@ -341,7 +342,13 @@ Object encode(Object str, @SuppressWarnings("unused") Object errors) {
|
341 | 342 | abstract static class UnicodeEscapeDecode extends PythonBinaryBuiltinNode {
|
342 | 343 | @Specialization(guards = "isBytes(bytes)")
|
343 | 344 | Object encode(VirtualFrame frame, Object bytes, @SuppressWarnings("unused") PNone errors,
|
344 |
| - @Cached("create()") BytesNodes.ToBytesNode toBytes) { |
| 345 | + @Shared("toBytes") @Cached("create()") BytesNodes.ToBytesNode toBytes) { |
| 346 | + return encode(frame, bytes, "", toBytes); |
| 347 | + } |
| 348 | + |
| 349 | + @Specialization(guards = "isBytes(bytes)") |
| 350 | + Object encode(VirtualFrame frame, Object bytes, @SuppressWarnings("unused") String errors, |
| 351 | + @Shared("toBytes") @Cached("create()") BytesNodes.ToBytesNode toBytes) { |
345 | 352 | // for now we'll just parse this as a String, ignoring any error strategies
|
346 | 353 | PythonCore core = getCore();
|
347 | 354 | byte[] byteArray = toBytes.execute(frame, bytes);
|
|
0 commit comments