No more LUA_ERRGCMM errors

Errors in finalizers (__gc metamethods) are never propagated.
Instead, they generate a warning.
This commit is contained in:
Roberto Ierusalimschy
2019-01-01 12:14:56 -02:00
parent 437a5b07d4
commit c6f7181e91
10 changed files with 143 additions and 109 deletions

View File

@@ -722,8 +722,6 @@ Lua calls the finalizers of all objects marked for finalization,
following the reverse order that they were marked.
If any finalizer marks objects for collection during that phase,
these marks have no effect.
If any finalizer raises an error during that phase,
its execution is interrupted but the error is ignored.
Finalizers cannot yield.
@@ -2645,8 +2643,7 @@ by looking only at its arguments
The third field, @T{x},
tells whether the function may raise errors:
@Char{-} means the function never raises any error;
@Char{m} means the function may raise out-of-memory errors
and errors running a finalizer;
@Char{m} means the function may raise only out-of-memory errors;
@Char{v} means the function may raise the errors explained in the text;
@Char{e} means the function can run arbitrary Lua code,
either directly or through metamethods,
@@ -3364,12 +3361,6 @@ syntax error during precompilation;}
@item{@Lid{LUA_ERRMEM}|
@x{memory allocation (out-of-memory) error};}
@item{@Lid{LUA_ERRGCMM}|
error while running a @idx{__gc} metamethod.
(This error has no relation with the chunk being loaded.
It is generated by the garbage collector.)
}
}
The @id{lua_load} function uses a user-supplied @id{reader} function
@@ -3564,13 +3555,6 @@ For such errors, Lua does not call the @x{message handler}.
error while running the @x{message handler}.
}
@item{@defid{LUA_ERRGCMM}|
error while running a @idx{__gc} metamethod.
For such errors, Lua does not call the @x{message handler}
(as this kind of error typically has no relation
with the function being called).
}
}
}
@@ -6298,6 +6282,8 @@ The current value of this variable is @St{Lua 5.4}.
@LibEntry{warn (message)|
Emits a warning with the given message.
Note that messages not ending with an end-of-line
are assumed to be continued by the message in the next call.
}
@@ -8773,6 +8759,12 @@ so there is no need to check whether they are using the same
address space.)
}
@item{
The constant @Lid{LUA_ERRGCMM} was removed.
Errors in finalizers are never propagated;
instead, they generate a warning.
}
}
}