diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-05-02 16:41:43 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-05-02 16:41:43 -0300 |
commit | 6443185167c77adcc8552a3fee7edab7895db1a9 (patch) | |
tree | 20add1421687313b7dcb4b9481771ed60d21d3c5 | |
parent | e15f1f2bb7a38a3c94519294d031e48508d65006 (diff) | |
download | lua-5.4.6.tar.gz lua-5.4.6.tar.bz2 lua-5.4.6.zip |
"Emergency" new version 5.4.6v5.4.6
'lua_resetthread' is back to its original signature, to avoid
incompatibilities in the ABI between releases of the same version.
New function 'lua_closethread' added with the "correct" signature.
-rw-r--r-- | lcorolib.c | 4 | ||||
-rw-r--r-- | lstate.c | 10 | ||||
-rw-r--r-- | ltests.c | 2 | ||||
-rw-r--r-- | lua.h | 7 | ||||
-rw-r--r-- | manual/manual.of | 40 |
5 files changed, 41 insertions, 22 deletions
@@ -76,7 +76,7 @@ static int luaB_auxwrap (lua_State *L) { | |||
76 | if (l_unlikely(r < 0)) { /* error? */ | 76 | if (l_unlikely(r < 0)) { /* error? */ |
77 | int stat = lua_status(co); | 77 | int stat = lua_status(co); |
78 | if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ | 78 | if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ |
79 | stat = lua_resetthread(co, L); /* close its tbc variables */ | 79 | stat = lua_closethread(co, L); /* close its tbc variables */ |
80 | lua_assert(stat != LUA_OK); | 80 | lua_assert(stat != LUA_OK); |
81 | lua_xmove(co, L, 1); /* move error message to the caller */ | 81 | lua_xmove(co, L, 1); /* move error message to the caller */ |
82 | } | 82 | } |
@@ -172,7 +172,7 @@ static int luaB_close (lua_State *L) { | |||
172 | int status = auxstatus(L, co); | 172 | int status = auxstatus(L, co); |
173 | switch (status) { | 173 | switch (status) { |
174 | case COS_DEAD: case COS_YIELD: { | 174 | case COS_DEAD: case COS_YIELD: { |
175 | status = lua_resetthread(co, L); | 175 | status = lua_closethread(co, L); |
176 | if (status == LUA_OK) { | 176 | if (status == LUA_OK) { |
177 | lua_pushboolean(L, 1); | 177 | lua_pushboolean(L, 1); |
178 | return 1; | 178 | return 1; |
@@ -339,7 +339,7 @@ int luaE_resetthread (lua_State *L, int status) { | |||
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
342 | LUA_API int lua_resetthread (lua_State *L, lua_State *from) { | 342 | LUA_API int lua_closethread (lua_State *L, lua_State *from) { |
343 | int status; | 343 | int status; |
344 | lua_lock(L); | 344 | lua_lock(L); |
345 | L->nCcalls = (from) ? getCcalls(from) : 0; | 345 | L->nCcalls = (from) ? getCcalls(from) : 0; |
@@ -349,6 +349,14 @@ LUA_API int lua_resetthread (lua_State *L, lua_State *from) { | |||
349 | } | 349 | } |
350 | 350 | ||
351 | 351 | ||
352 | /* | ||
353 | ** Deprecated! Use 'lua_closethread' instead. | ||
354 | */ | ||
355 | LUA_API int lua_resetthread (lua_State *L) { | ||
356 | return lua_closethread(L, NULL); | ||
357 | } | ||
358 | |||
359 | |||
352 | LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | 360 | LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { |
353 | int i; | 361 | int i; |
354 | lua_State *L; | 362 | lua_State *L; |
@@ -1533,7 +1533,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
1533 | lua_newthread(L1); | 1533 | lua_newthread(L1); |
1534 | } | 1534 | } |
1535 | else if EQ("resetthread") { | 1535 | else if EQ("resetthread") { |
1536 | lua_pushinteger(L1, lua_resetthread(L1, L)); | 1536 | lua_pushinteger(L1, lua_resetthread(L1)); /* deprecated */ |
1537 | } | 1537 | } |
1538 | else if EQ("newuserdata") { | 1538 | else if EQ("newuserdata") { |
1539 | lua_newuserdata(L1, getnum); | 1539 | lua_newuserdata(L1, getnum); |
@@ -18,10 +18,10 @@ | |||
18 | 18 | ||
19 | #define LUA_VERSION_MAJOR "5" | 19 | #define LUA_VERSION_MAJOR "5" |
20 | #define LUA_VERSION_MINOR "4" | 20 | #define LUA_VERSION_MINOR "4" |
21 | #define LUA_VERSION_RELEASE "5" | 21 | #define LUA_VERSION_RELEASE "6" |
22 | 22 | ||
23 | #define LUA_VERSION_NUM 504 | 23 | #define LUA_VERSION_NUM 504 |
24 | #define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 5) | 24 | #define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 6) |
25 | 25 | ||
26 | #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR | 26 | #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR |
27 | #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE | 27 | #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE |
@@ -163,7 +163,8 @@ extern const char lua_ident[]; | |||
163 | LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); | 163 | LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); |
164 | LUA_API void (lua_close) (lua_State *L); | 164 | LUA_API void (lua_close) (lua_State *L); |
165 | LUA_API lua_State *(lua_newthread) (lua_State *L); | 165 | LUA_API lua_State *(lua_newthread) (lua_State *L); |
166 | LUA_API int (lua_resetthread) (lua_State *L, lua_State *from); | 166 | LUA_API int (lua_closethread) (lua_State *L, lua_State *from); |
167 | LUA_API int (lua_resetthread) (lua_State *L); /* Deprecated! */ | ||
167 | 168 | ||
168 | LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); | 169 | LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); |
169 | 170 | ||
diff --git a/manual/manual.of b/manual/manual.of index ac1d7e60..f8d8ddd4 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -3167,6 +3167,27 @@ when called through this function. | |||
3167 | 3167 | ||
3168 | } | 3168 | } |
3169 | 3169 | ||
3170 | @APIEntry{int lua_closethread (lua_State *L, lua_State *from);| | ||
3171 | @apii{0,?,-} | ||
3172 | |||
3173 | Resets a thread, cleaning its call stack and closing all pending | ||
3174 | to-be-closed variables. | ||
3175 | Returns a status code: | ||
3176 | @Lid{LUA_OK} for no errors in the thread | ||
3177 | (either the original error that stopped the thread or | ||
3178 | errors in closing methods), | ||
3179 | or an error status otherwise. | ||
3180 | In case of error, | ||
3181 | leaves the error object on the top of the stack. | ||
3182 | |||
3183 | The parameter @id{from} represents the coroutine that is resetting @id{L}. | ||
3184 | If there is no such coroutine, | ||
3185 | this parameter can be @id{NULL}. | ||
3186 | |||
3187 | (This function was introduced in @N{release 5.4.6}.) | ||
3188 | |||
3189 | } | ||
3190 | |||
3170 | @APIEntry{int lua_compare (lua_State *L, int index1, int index2, int op);| | 3191 | @APIEntry{int lua_compare (lua_State *L, int index1, int index2, int op);| |
3171 | @apii{0,0,e} | 3192 | @apii{0,0,e} |
3172 | 3193 | ||
@@ -4160,23 +4181,12 @@ and then pops the top element. | |||
4160 | 4181 | ||
4161 | } | 4182 | } |
4162 | 4183 | ||
4163 | @APIEntry{int lua_resetthread (lua_State *L, lua_State *from);| | 4184 | @APIEntry{int lua_resetthread (lua_State *L);| |
4164 | @apii{0,?,-} | 4185 | @apii{0,?,-} |
4165 | 4186 | ||
4166 | Resets a thread, cleaning its call stack and closing all pending | 4187 | This function is deprecated; |
4167 | to-be-closed variables. | 4188 | it is equivalent to @Lid{lua_closethread} with |
4168 | Returns a status code: | 4189 | @id{from} being @id{NULL}. |
4169 | @Lid{LUA_OK} for no errors in the thread | ||
4170 | (either the original error that stopped the thread or | ||
4171 | errors in closing methods), | ||
4172 | or an error status otherwise. | ||
4173 | In case of error, | ||
4174 | leaves the error object on the top of the stack. | ||
4175 | |||
4176 | The parameter @id{from} represents the coroutine that is resetting @id{L}. | ||
4177 | If there is no such coroutine, | ||
4178 | this parameter can be @id{NULL}. | ||
4179 | (This parameter was introduced in @N{release 5.4.5}.) | ||
4180 | 4190 | ||
4181 | } | 4191 | } |
4182 | 4192 | ||