mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
Update vm.h
This commit is contained in:
parent
ded4a16d7b
commit
d9117c4b6a
7
src/vm.h
7
src/vm.h
@ -1056,13 +1056,18 @@ class ThreadedVM : public VM {
|
||||
if(ret.has_value()) return PyStr(ret.value());
|
||||
return None;
|
||||
}
|
||||
|
||||
PyVar jsonRpc(const PyVar& obj){
|
||||
return jsonRpc(asJson(obj));
|
||||
}
|
||||
public:
|
||||
ThreadedVM(bool use_stdio) : VM(use_stdio) {
|
||||
bindBuiltinFunc("jsonrpc", [](VM* vm, const pkpy::ArgList& args){
|
||||
ThreadedVM *tvm = dynamic_cast<ThreadedVM*>(vm);
|
||||
if(tvm == nullptr) UNREACHABLE();
|
||||
tvm->__checkArgSize(args, 1);
|
||||
return tvm->jsonRpc(tvm->PyStr_AS_C(args[0]));
|
||||
tvm->__checkType(args[0], vm->_types["dict"_c]);
|
||||
return tvm->jsonRpc(args[0]);
|
||||
});
|
||||
|
||||
bindBuiltinFunc("input", [](VM* vm, const pkpy::ArgList& args) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user