From 16ae6cb1fb06217e5b32f74ec72ce9fce1923b56 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 17 Jun 2012 15:48:32 +0400 Subject: [PATCH] Fix lua bug: 'peaceful' unwind of yielded pcall doesn't restore errfunc. I.e. if the pcall results in no error, but a yield happens inside it, the active errfunc is not restored to its previous value. --- depends/lua/src/ldo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/depends/lua/src/ldo.c b/depends/lua/src/ldo.c index d18e33cd4..35d95ae4e 100644 --- a/depends/lua/src/ldo.c +++ b/depends/lua/src/ldo.c @@ -402,6 +402,9 @@ static void finishCcall (lua_State *L) { int n; lua_assert(ci->u.c.k != NULL); /* must have a continuation */ lua_assert(L->nny == 0); + /* finish 'lua_pcallk' */ + if (ci->callstatus & CIST_YPCALL) + L->errfunc = ci->u.c.old_errfunc; /* finish 'lua_callk' */ adjustresults(L, ci->nresults); /* call continuation function */