Cleaner handling of errors in '__close' metamethods

Instead of protecting each individual metamethod call, protect the
entire call to 'luaF_close'.
This commit is contained in:
Roberto Ierusalimschy
2020-12-28 11:40:30 -03:00
parent 0ceada8da9
commit 7af27ef59d
7 changed files with 80 additions and 75 deletions

2
lvm.c
View File

@@ -1662,7 +1662,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
if (TESTARG_k(i)) { /* may there be open upvalues? */
if (L->top < ci->top)
L->top = ci->top;
luaF_close(L, base, LUA_OK);
luaF_close(L, base, CLOSEKTOP);
updatetrap(ci);
updatestack(ci);
}