[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3.5 'xpcall' message handler is ignored by 'collectgarbage()' function
- From: Andrew Gierth <andrew@...>
- Date: Sun, 08 Sep 2019 11:47:06 +0100
>>>>> "Guenther" == Guenther Kramer <kramer.guenther@orbcomm.com> writes:
Guenther> Hi,
Guenther> I am trying to generate a traceback when garbage collection
Guenther> raises an exception. This of course can happen if the '__gc'
Guenther> metamethod raises an exception. The problem I am encountering
Guenther> is that the message handler is ignored:
Quoth the documentation:
"(The message handler is called only for regular runtime errors. It is
not called for memory-allocation errors nor for errors while running
finalizers.)"
What you'd need to do is to wrap each __gc method in its own xpcall.
--
Andrew.