From 265ab42eb0a759d9ab26ba7216387160fc195962 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 13 May 2024 21:28:31 +0800 Subject: [PATCH] some fix --- src/vm.cpp | 2 +- tests/44_decorator.py | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/vm.cpp b/src/vm.cpp index 76ec6e6a..c867aa52 100644 --- a/src/vm.cpp +++ b/src/vm.cpp @@ -1132,7 +1132,7 @@ PyVar VM::vectorcall(int ARGC, int KWARGC, bool op_call){ p1[-(ARGC + 2)] = call_f; p1[-(ARGC + 1)] = self; // [call_f, self, args..., kwargs...] - return vectorcall(ARGC, KWARGC, false); + return vectorcall(ARGC, KWARGC, op_call); } TypeError(_type_name(vm, callable_t).escape() + " object is not callable"); PK_UNREACHABLE() diff --git a/tests/44_decorator.py b/tests/44_decorator.py index a71c096d..925d4125 100644 --- a/tests/44_decorator.py +++ b/tests/44_decorator.py @@ -1,15 +1,5 @@ from functools import cache -@cache -@cache -@cache -def fib(n): - if n < 2: - return n - return fib(n-1) + fib(n-2) - -assert fib(32) == 2178309 - class A: def __init__(self, x): self._x = x @@ -36,4 +26,16 @@ B.x = property( b = B() assert b.x == 1 b.x = 2 -assert b.x == 2 \ No newline at end of file +assert b.x == 2 + + +@cache +@cache +@cache +def fib(n): + # print(f'fib({n})') + if n < 2: + return n + return fib(n-1) + fib(n-2) + +assert fib(32) == 2178309 \ No newline at end of file