|
129 | 129 | import com.oracle.graal.python.builtins.objects.method.PBuiltinMethod;
|
130 | 130 | import com.oracle.graal.python.builtins.objects.module.PythonModule;
|
131 | 131 | import com.oracle.graal.python.builtins.objects.object.PythonObject;
|
| 132 | +import com.oracle.graal.python.builtins.objects.str.PString; |
| 133 | +import com.oracle.graal.python.builtins.objects.str.StringNodes.StringMaterializeNode; |
132 | 134 | import com.oracle.graal.python.builtins.objects.tuple.PTuple;
|
133 | 135 | import com.oracle.graal.python.builtins.objects.type.PythonClass;
|
134 | 136 | import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
|
@@ -1303,13 +1305,17 @@ public static final class GraalHPyUnicodeFromString extends GraalHPyContextFunct
|
1303 | 1305 | Object execute(Object[] arguments,
|
1304 | 1306 | @Cached HPyAsContextNode asContextNode,
|
1305 | 1307 | @Cached FromCharPointerNode fromCharPointerNode,
|
| 1308 | + @Cached StringMaterializeNode stringMaterializeNode, |
1306 | 1309 | @Cached HPyTransformExceptionToNativeNode transformExceptionToNativeNode,
|
1307 | 1310 | @Cached HPyAsHandleNode asHandleNode) throws ArityException {
|
1308 | 1311 | checkArity(arguments, 2);
|
1309 | 1312 | GraalHPyContext context = asContextNode.execute(arguments[0]);
|
1310 | 1313 | try {
|
1311 | 1314 | // TODO(fa) provide encoding (utf8)
|
1312 | 1315 | Object str = fromCharPointerNode.execute(arguments[1]);
|
| 1316 | + if (str instanceof PString) { |
| 1317 | + str = stringMaterializeNode.execute((PString) str); |
| 1318 | + } |
1313 | 1319 | return asHandleNode.execute(context, str);
|
1314 | 1320 | } catch (PException e) {
|
1315 | 1321 | transformExceptionToNativeNode.execute(context, e);
|
|
0 commit comments