From 066e0f93c4901e601d93e31fb700f8f66f95feb8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 14 Dec 2021 12:50:05 -0300 Subject: Fix debug information about finalizers The flag CIST_FIN does not mark a finalizer, but the function that was running when the finalizer was called. (So, the function did not call the finalizer, but it looks that way in the stack.) --- testes/db.lua | 2 +- testes/gc.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'testes') diff --git a/testes/db.lua b/testes/db.lua index e0699724..f891e9b8 100644 --- a/testes/db.lua +++ b/testes/db.lua @@ -887,7 +887,7 @@ do -- testing debug info for finalizers -- create a piece of garbage with a finalizer setmetatable({}, {__gc = function () - local t = debug.getinfo(2) -- get callee information + local t = debug.getinfo(1) -- get function information assert(t.namewhat == "metamethod") name = t.name end}) diff --git a/testes/gc.lua b/testes/gc.lua index d865cb28..381c5548 100644 --- a/testes/gc.lua +++ b/testes/gc.lua @@ -371,7 +371,7 @@ if T then warn("@on"); warn("@store") collectgarbage() - assert(string.find(_WARN, "error in __gc metamethod")) + assert(string.find(_WARN, "error in __gc")) assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = false for i = 8, 10 do assert(s[i]) end -- cgit v1.2.3-55-g6feb