aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:07:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:07:39 -0300
commit664bda02ba4bd167728a2acbe658cc4a9dd9b0b5 (patch)
treefc6fe196de8326e2eee3deb81e448525a362afa8 /testes
parent2d8d5c74b5ef3d333314feede0165df7c3d13811 (diff)
downloadlua-664bda02ba4bd167728a2acbe658cc4a9dd9b0b5.tar.gz
lua-664bda02ba4bd167728a2acbe658cc4a9dd9b0b5.tar.bz2
lua-664bda02ba4bd167728a2acbe658cc4a9dd9b0b5.zip
fixing 'lua_status' in panic.
'luaD_throw' may call 'luaE_resetthread', which returns an error code but clears 'L->status'; so, 'luaD_throw' should set that status again.
Diffstat (limited to 'testes')
-rw-r--r--testes/api.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/testes/api.lua b/testes/api.lua
index b7e34f7f..21f703fd 100644
--- a/testes/api.lua
+++ b/testes/api.lua
@@ -416,6 +416,10 @@ do
416 -- trivial error 416 -- trivial error
417 assert(T.checkpanic("pushstring hi; error") == "hi") 417 assert(T.checkpanic("pushstring hi; error") == "hi")
418 418
419 -- thread status inside panic (bug in 5.4.4)
420 assert(T.checkpanic("pushstring hi; error", "threadstatus; return 2") ==
421 "ERRRUN")
422
419 -- using the stack inside panic 423 -- using the stack inside panic
420 assert(T.checkpanic("pushstring hi; error;", 424 assert(T.checkpanic("pushstring hi; error;",
421 [[checkstack 5 XX 425 [[checkstack 5 XX
@@ -433,6 +437,21 @@ do
433 assert(T.checkpanic("newuserdata 20000") == MEMERRMSG) 437 assert(T.checkpanic("newuserdata 20000") == MEMERRMSG)
434 T.totalmem(0) -- restore high limit 438 T.totalmem(0) -- restore high limit
435 439
440 -- memory error + thread status
441 local x = T.checkpanic(
442 [[ alloccount 0 # force a memory error in next line
443 newtable
444 ]],
445 [[
446 alloccount -1 # allow free allocations again
447 pushstring XX
448 threadstatus
449 concat 2 # to make sure message came from here
450 return 1
451 ]])
452 T.alloccount()
453 assert(x == "XX" .. "not enough memory")
454
436 -- stack error 455 -- stack error
437 if not _soft then 456 if not _soft then
438 local msg = T.checkpanic[[ 457 local msg = T.checkpanic[[