diff options
| author | Roberto I <roberto@inf.puc-rio.br> | 2025-12-01 10:25:44 -0300 |
|---|---|---|
| committer | Roberto I <roberto@inf.puc-rio.br> | 2025-12-01 10:25:44 -0300 |
| commit | 985ef32248f17ae4ca2d4e83e5e39e15393bb2f6 (patch) | |
| tree | 99df4013b6a20edb9fbf66a36623720ce762cec2 | |
| parent | a07f6a824197d7dc01c321599d3bc71936a2590e (diff) | |
| download | lua-985ef32248f17ae4ca2d4e83e5e39e15393bb2f6.tar.gz lua-985ef32248f17ae4ca2d4e83e5e39e15393bb2f6.tar.bz2 lua-985ef32248f17ae4ca2d4e83e5e39e15393bb2f6.zip | |
This should had been corrected in commit fd897027f1.
| -rw-r--r-- | lcorolib.c | 10 |
1 files changed, 6 insertions, 4 deletions
| @@ -189,15 +189,17 @@ static int luaB_close (lua_State *L) { | |||
| 189 | return 2; | 189 | return 2; |
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | case COS_RUN: /* running coroutine? */ | 192 | case COS_NORM: |
| 193 | return luaL_error(L, "cannot close a %s coroutine", statname[status]); | ||
| 194 | case COS_RUN: | ||
| 193 | lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD); /* get main */ | 195 | lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD); /* get main */ |
| 194 | if (lua_tothread(L, -1) == co) | 196 | if (lua_tothread(L, -1) == co) |
| 195 | return luaL_error(L, "cannot close main thread"); | 197 | return luaL_error(L, "cannot close main thread"); |
| 196 | lua_closethread(co, L); /* close itself */ | 198 | lua_closethread(co, L); /* close itself */ |
| 197 | lua_assert(0); /* previous call does not return */ | 199 | /* previous call does not return *//* FALLTHROUGH */ |
| 200 | default: | ||
| 201 | lua_assert(0); | ||
| 198 | return 0; | 202 | return 0; |
| 199 | default: /* normal or running coroutine */ | ||
| 200 | return luaL_error(L, "cannot close a %s coroutine", statname[status]); | ||
| 201 | } | 203 | } |
| 202 | } | 204 | } |
| 203 | 205 | ||
