Hi, Sergey,
thanks for the patch! LGTM
From: Mike Pall <mike> Suggested by Hydroque. (cherry picked from commit 03cd5aa749c1bc3bb4b7d4289236b6096cb3dc85) This patch makes the Lua stack balanced after using the aforementioned function, which is considered a good practice [1]. Be aware that the only argument on the stack is dummy NULL from the `lua_cpcall()`, so it can be easily cleared. This doesn't change the behaviour since all calls of `print_jit_status()` are followed by `dotty()` with a call to `loadline()`, which clears the stack anyway. Sergey Kaplun: * added the description for the patch [1]: https://www.lua.org/manual/5.1/manual.html#lua_call Part of tarantool/tarantool#10199 --- Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-382-clear-stack-after-jit-status Issue: https://github.com/tarantool/tarantool/issues/10199 src/luajit.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/luajit.c b/src/luajit.c index b63c92d1..e04a5a30 100644 --- a/src/luajit.c +++ b/src/luajit.c @@ -162,6 +162,7 @@ static void print_jit_status(lua_State *L) fputs(s, stdout); } putc('\n', stdout); + lua_settop(L, 0); /* clear stack */ } static void createargtable(lua_State *L, char **argv, int argc, int argf)