API asserts for illegal pops of to-be-closed variables

This commit is contained in:
Roberto Ierusalimschy
2024-03-11 14:05:06 -03:00
parent 7237eb3f1c
commit 65b07dd53d
5 changed files with 45 additions and 30 deletions

View File

@@ -1193,7 +1193,8 @@ do
local a, b = pcall(T.makeCfunc[[
call 0 1 # create resource
toclose -1 # mark it to be closed
error # resource is the error object
pushvalue -1 # replicate it as error object
error # resource right after error object
]], newresource)
assert(a == false and b[1] == 11)
assert(#openresource == 0) -- was closed