From cd6484a61ab430e174577f6ca7cdcc05fc23abaa Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Thu, 9 Feb 2023 15:45:23 +0800 Subject: [PATCH] Update pocketpy.h --- src/pocketpy.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pocketpy.h b/src/pocketpy.h index 8776bee5..c6c734cf 100644 --- a/src/pocketpy.h +++ b/src/pocketpy.h @@ -520,20 +520,15 @@ void add_module_time(VM* vm){ void add_module_sys(VM* vm){ PyVar mod = vm->new_module("sys"); - vm->bind_func<1>(mod, "getrefcount", [](VM* vm, const pkpy::Args& args) { - return vm->PyInt(args[0].use_count()); - }); + vm->setattr(mod, "version", vm->PyStr(PK_VERSION)); - vm->bind_func<0>(mod, "getrecursionlimit", [](VM* vm, const pkpy::Args& args) { - return vm->PyInt(vm->maxRecursionDepth); - }); + vm->bind_func<1>(mod, "getrefcount", CPP_LAMBDA(vm->PyInt(args[0].use_count()))); + 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->maxRecursionDepth = (int)vm->PyInt_AS_C(args[0]); return vm->None; }); - - vm->setattr(mod, "version", vm->PyStr(PK_VERSION)); } void add_module_json(VM* vm){