mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 20:10:17 +00:00
Update pocketpy.h
This commit is contained in:
parent
e421a06923
commit
cd6484a61a
@ -520,20 +520,15 @@ void add_module_time(VM* vm){
|
|||||||
|
|
||||||
void add_module_sys(VM* vm){
|
void add_module_sys(VM* vm){
|
||||||
PyVar mod = vm->new_module("sys");
|
PyVar mod = vm->new_module("sys");
|
||||||
vm->bind_func<1>(mod, "getrefcount", [](VM* vm, const pkpy::Args& args) {
|
vm->setattr(mod, "version", vm->PyStr(PK_VERSION));
|
||||||
return vm->PyInt(args[0].use_count());
|
|
||||||
});
|
|
||||||
|
|
||||||
vm->bind_func<0>(mod, "getrecursionlimit", [](VM* vm, const pkpy::Args& args) {
|
vm->bind_func<1>(mod, "getrefcount", CPP_LAMBDA(vm->PyInt(args[0].use_count())));
|
||||||
return vm->PyInt(vm->maxRecursionDepth);
|
vm->bind_func<0>(mod, "getrecursionlimit", CPP_LAMBDA(vm->PyInt(vm->maxRecursionDepth)));
|
||||||
});
|
|
||||||
|
|
||||||
vm->bind_func<1>(mod, "setrecursionlimit", [](VM* vm, const pkpy::Args& args) {
|
vm->bind_func<1>(mod, "setrecursionlimit", [](VM* vm, const pkpy::Args& args) {
|
||||||
vm->maxRecursionDepth = (int)vm->PyInt_AS_C(args[0]);
|
vm->maxRecursionDepth = (int)vm->PyInt_AS_C(args[0]);
|
||||||
return vm->None;
|
return vm->None;
|
||||||
});
|
});
|
||||||
|
|
||||||
vm->setattr(mod, "version", vm->PyStr(PK_VERSION));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_module_json(VM* vm){
|
void add_module_json(VM* vm){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user