Permalink
Browse files

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.
  • Loading branch information...
angavrilov committed Jun 17, 2012
1 parent eeaae91 commit 16ae6cb1fb06217e5b32f74ec72ce9fce1923b56
Showing with 3 additions and 0 deletions.
  1. +3 −0 depends/lua/src/ldo.c
View
@@ -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 */

0 comments on commit 16ae6cb

Please sign in to comment.