diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-12-14 12:50:05 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-12-14 12:50:05 -0300 |
commit | 066e0f93c4901e601d93e31fb700f8f66f95feb8 (patch) | |
tree | 8b7464bbc4bbe12db97eb34f3b28874caffd1411 /testes | |
parent | 0bfc572e51d9035a615ef6e9523f736c9ffa8e57 (diff) | |
download | lua-066e0f93c4901e601d93e31fb700f8f66f95feb8.tar.gz lua-066e0f93c4901e601d93e31fb700f8f66f95feb8.tar.bz2 lua-066e0f93c4901e601d93e31fb700f8f66f95feb8.zip |
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.)
Diffstat (limited to 'testes')
-rw-r--r-- | testes/db.lua | 2 | ||||
-rw-r--r-- | testes/gc.lua | 2 |
2 files changed, 2 insertions, 2 deletions
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 | |||
887 | 887 | ||
888 | -- create a piece of garbage with a finalizer | 888 | -- create a piece of garbage with a finalizer |
889 | setmetatable({}, {__gc = function () | 889 | setmetatable({}, {__gc = function () |
890 | local t = debug.getinfo(2) -- get callee information | 890 | local t = debug.getinfo(1) -- get function information |
891 | assert(t.namewhat == "metamethod") | 891 | assert(t.namewhat == "metamethod") |
892 | name = t.name | 892 | name = t.name |
893 | end}) | 893 | 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 | |||
371 | 371 | ||
372 | warn("@on"); warn("@store") | 372 | warn("@on"); warn("@store") |
373 | collectgarbage() | 373 | collectgarbage() |
374 | assert(string.find(_WARN, "error in __gc metamethod")) | 374 | assert(string.find(_WARN, "error in __gc")) |
375 | assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = false | 375 | assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = false |
376 | for i = 8, 10 do assert(s[i]) end | 376 | for i = 8, 10 do assert(s[i]) end |
377 | 377 | ||