diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-18 11:22:42 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-12-18 11:22:42 -0300 |
commit | 409256b7849ec5ab3296cb0ab9eba3d65955d5ea (patch) | |
tree | 13d6327093e900cab0b23c4d09f344a281630c73 /testes/cstack.lua | |
parent | b17178b27a55bd5eeb51538bec935972fd58f1ea (diff) | |
download | lua-409256b7849ec5ab3296cb0ab9eba3d65955d5ea.tar.gz lua-409256b7849ec5ab3296cb0ab9eba3d65955d5ea.tar.bz2 lua-409256b7849ec5ab3296cb0ab9eba3d65955d5ea.zip |
'coroutine.close'/'lua_resetthread' report original errors
Besides errors in closing methods, 'coroutine.close' and
'lua_resetthread' also consider the original error that stopped the
thread, if any.
Diffstat (limited to 'testes/cstack.lua')
-rw-r--r-- | testes/cstack.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/testes/cstack.lua b/testes/cstack.lua index 8ac48e89..7bd55063 100644 --- a/testes/cstack.lua +++ b/testes/cstack.lua | |||
@@ -135,14 +135,18 @@ if T then | |||
135 | local topB, sizeB -- top and size Before overflow | 135 | local topB, sizeB -- top and size Before overflow |
136 | local topA, sizeA -- top and size After overflow | 136 | local topA, sizeA -- top and size After overflow |
137 | topB, sizeB = T.stacklevel() | 137 | topB, sizeB = T.stacklevel() |
138 | collectgarbage("stop") -- __gc should not be called with a full stack | ||
138 | xpcall(f, err) | 139 | xpcall(f, err) |
140 | collectgarbage("restart") | ||
139 | topA, sizeA = T.stacklevel() | 141 | topA, sizeA = T.stacklevel() |
140 | -- sizes should be comparable | 142 | -- sizes should be comparable |
141 | assert(topA == topB and sizeA < sizeB * 2) | 143 | assert(topA == topB and sizeA < sizeB * 2) |
142 | print(string.format("maximum stack size: %d", stack1)) | 144 | print(string.format("maximum stack size: %d", stack1)) |
143 | LIM = N -- will stop recursion at maximum level | 145 | LIM = N -- will stop recursion at maximum level |
144 | N = 0 -- to count again | 146 | N = 0 -- to count again |
147 | collectgarbage("stop") -- __gc should not be called with a full stack | ||
145 | f() | 148 | f() |
149 | collectgarbage("restart") | ||
146 | print"+" | 150 | print"+" |
147 | end | 151 | end |
148 | 152 | ||