소스 검색

Update pocketpy.h

blueloveTH 3 년 전
부모
커밋
fc6f61ad3d
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      src/pocketpy.h

+ 3 - 2
src/pocketpy.h

@@ -40,10 +40,11 @@ void __initializeBuiltinFunctions(VM* _vm) {
 #undef BIND_NUM_LOGICAL_OPT
 
     _vm->bindBuiltinFunc("print", [](VM* vm, PyVarList args) {
+        _StrStream ss;
         for (auto& arg : args){
-            _Str s = vm->PyStr_AS_C(vm->asStr(arg)) + " ";
-            vm->_stdout(vm, s.c_str());
+            ss << vm->PyStr_AS_C(vm->asStr(arg)) << " ";
         }
+        vm->_stdout(ss.str());
         vm->_stdout(vm, "\n");
         return vm->None;
     });