Browse Source

must also reset CIST_OAH if necessary (CallInfo is not a fresh one)

Roberto Ierusalimschy 11 years ago
parent
commit
8b5940e7ca
1 changed files with 6 additions and 5 deletions
  1. 6 5
      lapi.c

+ 6 - 5
lapi.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lapi.c,v 2.215 2014/06/10 17:41:38 roberto Exp roberto $
+** $Id: lapi.c,v 2.216 2014/06/10 18:51:21 roberto Exp roberto $
 ** Lua API
 ** See Copyright Notice in lua.h
 */
@@ -970,10 +970,11 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
     ci->extra = savestack(L, c.func);
     ci->u.c.old_errfunc = L->errfunc;
     L->errfunc = func;
-    if (L->allowhook)
-      ci->callstatus |= CIST_OAH;  /* save original value of 'allowhook' */
-    /* mark that function may do error recovery */
-    ci->callstatus |= CIST_YPCALL;
+    if (L->allowhook)  /* save original value of 'allowhook' */
+      ci->callstatus |= CIST_OAH;
+    else
+      ci->callstatus &= ~CIST_OAH;
+    ci->callstatus |= CIST_YPCALL;  /* function can do error recovery */
     luaD_call(L, c.func, nresults, 1);  /* do the call */
     ci->callstatus &= ~CIST_YPCALL;
     L->errfunc = ci->u.c.old_errfunc;