From b529aefc531276775f8827052d5594749232cf07 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 12 Jun 2024 16:02:01 -0300 Subject: Bug: luaL_traceback may need more than 5 stack slots --- testes/errors.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'testes') diff --git a/testes/errors.lua b/testes/errors.lua index 01cfe906..80d91a92 100644 --- a/testes/errors.lua +++ b/testes/errors.lua @@ -91,7 +91,7 @@ end if not T then (Message or print) - ('\n >>> testC not active: skipping memory message test <<<\n') + ('\n >>> testC not active: skipping tests for messages in C <<<\n') else print "testing memory error message" local a = {} @@ -104,6 +104,19 @@ else end) T.totalmem(0) assert(not st and msg == "not enough" .. " memory") + + -- stack space for luaL_traceback (bug in 5.4.6) + local res = T.testC[[ + # push 16 elements on the stack + pushnum 1; pushnum 1; pushnum 1; pushnum 1; pushnum 1; + pushnum 1; pushnum 1; pushnum 1; pushnum 1; pushnum 1; + pushnum 1; pushnum 1; pushnum 1; pushnum 1; pushnum 1; + pushnum 1; + # traceback should work with 4 remaining slots + traceback xuxu 1; + return 1 + ]] + assert(string.find(res, "xuxu.-main chunk")) end -- cgit v1.2.3-55-g6feb