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.
develop
Alexander Gavrilov 2012-06-17 15:48:32 +04:00
parent eeaae916ed
commit 16ae6cb1fb
1 changed files with 3 additions and 0 deletions

@ -402,6 +402,9 @@ static void finishCcall (lua_State *L) {
int n; int n;
lua_assert(ci->u.c.k != NULL); /* must have a continuation */ lua_assert(ci->u.c.k != NULL); /* must have a continuation */
lua_assert(L->nny == 0); lua_assert(L->nny == 0);
/* finish 'lua_pcallk' */
if (ci->callstatus & CIST_YPCALL)
L->errfunc = ci->u.c.old_errfunc;
/* finish 'lua_callk' */ /* finish 'lua_callk' */
adjustresults(L, ci->nresults); adjustresults(L, ci->nresults);
/* call continuation function */ /* call continuation function */