@@ -60,27 +60,9 @@ void Baseobj_print(PikaObj* self, Args* args) {
60
60
}
61
61
}
62
62
if (ARG_TYPE_OBJECT == arg_type ) {
63
- PikaObj * obj = arg_getPtr (arg );
64
- /* clang-format off */
65
- PIKA_PYTHON (
66
- __res = __str__ ()
67
- )
68
- /* clang-format on */
69
-
70
- /* check method arg */
71
- Arg * method_arg = obj_getMethodArg (obj , "__str__" );
72
- if (NULL != method_arg ) {
73
- arg_deinit (method_arg );
74
- const uint8_t bytes [] = {
75
- 0x08 , 0x00 , /* instruct array size */
76
- 0x00 , 0x82 , 0x01 , 0x00 , 0x00 , 0x04 , 0x09 , 0x00 , /* instruct
77
- array */
78
- 0x0f , 0x00 , /* const pool size */
79
- 0x00 , 0x5f , 0x5f , 0x73 , 0x74 , 0x72 , 0x5f , 0x5f , 0x00 ,
80
- 0x5f , 0x5f , 0x72 , 0x65 , 0x73 , 0x00 , /* const pool */
81
- };
82
- pikaVM_runByteCode (obj , (uint8_t * )bytes );
83
- __platform_printf ("%s\r\n" , obj_getStr (obj , "__res" ));
63
+ char * to_str = obj_toStr (arg_getPtr (arg ));
64
+ if (NULL != to_str ) {
65
+ __platform_printf ("%s\r\n" , to_str );
84
66
return ;
85
67
}
86
68
}
0 commit comments