mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 21:10:19 +00:00
fix a bug
This commit is contained in:
parent
7329c4288d
commit
9a4eef6168
9
src/vm.h
9
src/vm.h
@ -1047,7 +1047,7 @@ enum ThreadState {
|
|||||||
THREAD_FINISHED
|
THREAD_FINISHED
|
||||||
};
|
};
|
||||||
|
|
||||||
const _Str INPUT_JSONRPC_STR = "{\"method\":\"input\", \"params\":[]}";
|
const _Str INPUT_JSONRPC_STR = "{\"method\": \"input\", \"params\": []}";
|
||||||
|
|
||||||
class ThreadedVM : public VM {
|
class ThreadedVM : public VM {
|
||||||
std::thread* _thread = nullptr;
|
std::thread* _thread = nullptr;
|
||||||
@ -1062,10 +1062,6 @@ class ThreadedVM : public VM {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyVar jsonRpc(const PyVar& obj){
|
|
||||||
return jsonRpc(asJson(obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
void __deleteThread(){
|
void __deleteThread(){
|
||||||
if(_thread != nullptr){
|
if(_thread != nullptr){
|
||||||
if(!_thread->joinable()) UNREACHABLE();
|
if(!_thread->joinable()) UNREACHABLE();
|
||||||
@ -1081,7 +1077,8 @@ public:
|
|||||||
if(tvm == nullptr) UNREACHABLE();
|
if(tvm == nullptr) UNREACHABLE();
|
||||||
tvm->__checkArgSize(args, 1);
|
tvm->__checkArgSize(args, 1);
|
||||||
tvm->__checkType(args[0], vm->builtins->attribs["dict"_c]);
|
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) {
|
bindBuiltinFunc("input", [](VM* vm, const pkpy::ArgList& args) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user