|
|
@@ -60,27 +60,9 @@ void Baseobj_print(PikaObj* self, Args* args) {
|
|
|
}
|
|
|
}
|
|
|
if (ARG_TYPE_OBJECT == arg_type) {
|
|
|
- PikaObj* obj = arg_getPtr(arg);
|
|
|
- /* clang-format off */
|
|
|
- PIKA_PYTHON(
|
|
|
- __res = __str__()
|
|
|
- )
|
|
|
- /* clang-format on */
|
|
|
-
|
|
|
- /* check method arg */
|
|
|
- Arg* method_arg = obj_getMethodArg(obj, "__str__");
|
|
|
- if (NULL != method_arg) {
|
|
|
- arg_deinit(method_arg);
|
|
|
- const uint8_t bytes[] = {
|
|
|
- 0x08, 0x00, /* instruct array size */
|
|
|
- 0x00, 0x82, 0x01, 0x00, 0x00, 0x04, 0x09, 0x00, /* instruct
|
|
|
- array */
|
|
|
- 0x0f, 0x00, /* const pool size */
|
|
|
- 0x00, 0x5f, 0x5f, 0x73, 0x74, 0x72, 0x5f, 0x5f, 0x00,
|
|
|
- 0x5f, 0x5f, 0x72, 0x65, 0x73, 0x00, /* const pool */
|
|
|
- };
|
|
|
- pikaVM_runByteCode(obj, (uint8_t*)bytes);
|
|
|
- __platform_printf("%s\r\n", obj_getStr(obj, "__res"));
|
|
|
+ char* to_str = obj_toStr(arg_getPtr(arg));
|
|
|
+ if (NULL != to_str) {
|
|
|
+ __platform_printf("%s\r\n", to_str);
|
|
|
return;
|
|
|
}
|
|
|
}
|