aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:07:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-16 16:07:39 -0300
commit664bda02ba4bd167728a2acbe658cc4a9dd9b0b5 (patch)
treefc6fe196de8326e2eee3deb81e448525a362afa8 /ldo.c
parent2d8d5c74b5ef3d333314feede0165df7c3d13811 (diff)
downloadlua-664bda02ba4bd167728a2acbe658cc4a9dd9b0b5.tar.gz
lua-664bda02ba4bd167728a2acbe658cc4a9dd9b0b5.tar.bz2
lua-664bda02ba4bd167728a2acbe658cc4a9dd9b0b5.zip
fixing 'lua_status' in panic.
'luaD_throw' may call 'luaE_resetthread', which returns an error code but clears 'L->status'; so, 'luaD_throw' should set that status again.
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ldo.c b/ldo.c
index fb9df5d3..994ad6f0 100644
--- a/ldo.c
+++ b/ldo.c
@@ -133,6 +133,7 @@ l_noret luaD_throw (lua_State *L, int errcode) {
133 else { /* thread has no error handler */ 133 else { /* thread has no error handler */
134 global_State *g = G(L); 134 global_State *g = G(L);
135 errcode = luaE_resetthread(L, errcode); /* close all upvalues */ 135 errcode = luaE_resetthread(L, errcode); /* close all upvalues */
136 L->status = cast_byte(errcode);
136 if (g->mainthread->errorJmp) { /* main thread has a handler? */ 137 if (g->mainthread->errorJmp) { /* main thread has a handler? */
137 setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */ 138 setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */
138 luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ 139 luaD_throw(g->mainthread, errcode); /* re-throw in main thread */