fix a bug

This commit is contained in:
blueloveTH 2022-11-28 21:34:09 +08:00
parent 7329c4288d
commit 9a4eef6168

View File

@ -1047,7 +1047,7 @@ enum ThreadState {
THREAD_FINISHED
};
const _Str INPUT_JSONRPC_STR = "{\"method\":\"input\", \"params\":[]}";
const _Str INPUT_JSONRPC_STR = "{\"method\": \"input\", \"params\": []}";
class ThreadedVM : public VM {
std::thread* _thread = nullptr;
@ -1062,10 +1062,6 @@ class ThreadedVM : public VM {
return None;
}
PyVar jsonRpc(const PyVar& obj){
return jsonRpc(asJson(obj));
}
void __deleteThread(){
if(_thread != nullptr){
if(!_thread->joinable()) UNREACHABLE();
@ -1081,7 +1077,8 @@ public:
if(tvm == nullptr) UNREACHABLE();
tvm->__checkArgSize(args, 1);
tvm->__checkType(args[0], vm->builtins->attribs["dict"_c]);
return tvm->jsonRpc(args[0]);
_Str _json = tvm->PyStr_AS_C(tvm->asJson(args[0]));
return tvm->jsonRpc(_json);
});
bindBuiltinFunc("input", [](VM* vm, const pkpy::ArgList& args) {