<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lua/testes/coroutine.lua, branch v5.4.9</title>
<subtitle>A mirror of https://github.com/lua/lua
</subtitle>
<id>https://git.lua4.win/lua/atom?h=v5.4.9</id>
<link rel='self' href='https://git.lua4.win/lua/atom?h=v5.4.9'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/'/>
<updated>2025-03-17T19:14:17+00:00</updated>
<entry>
<title>Bug: message handler can be overwritten</title>
<updated>2025-03-17T19:14:17+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2025-03-17T19:14:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=3fe7be956f23385aa1950dc31e2f25127ccfc0ea'/>
<id>urn:sha1:3fe7be956f23385aa1950dc31e2f25127ccfc0ea</id>
<content type='text'>
A __close metamethod can overwrite a message handler in the stack
when closing a thread or a state.
</content>
</entry>
<entry>
<title>Bug: Yielding in a hook stops in the wrong instruction</title>
<updated>2024-01-11T16:44:16+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2024-01-11T16:44:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=e288c5a91883793d14ed9e9d93464f6ee0b08915'/>
<id>urn:sha1:e288c5a91883793d14ed9e9d93464f6ee0b08915</id>
<content type='text'>
Yielding in a hook must decrease the program counter, because it already
counted an instruction that, in the end, was not executed. However,
that decrement should be done only when about to restart the thread.
Otherwise, inspecting the thread with the debug library shows it one
instruction behind of where it really is.
</content>
</entry>
<entry>
<title>Avoid excessive name pollution in test files</title>
<updated>2022-12-28T21:34:11+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2022-12-28T21:34:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=314745ed8438d1276c6c928d5f9d4be018dfadb6'/>
<id>urn:sha1:314745ed8438d1276c6c928d5f9d4be018dfadb6</id>
<content type='text'>
Test files are more polite regarding the use of globals when locals
would do, and when globals are necessary deleting them after use.
</content>
</entry>
<entry>
<title>'lua_checkstack' doesn't need to check stack overflow</title>
<updated>2022-05-23T13:38:03+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2022-05-23T13:38:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=4a00f61276a9a38b0427fbae3dbbd86dfb5a0749'/>
<id>urn:sha1:4a00f61276a9a38b0427fbae3dbbd86dfb5a0749</id>
<content type='text'>
'luaD_growstack' already checks that. This commit also fixes an
internal bug in 'luaD_growstack': a large 'n' could cause an arithmetic
overflow when computing 'needed'.
</content>
</entry>
<entry>
<title>Bug: Wrong status in coroutine during reset</title>
<updated>2021-11-08T14:55:25+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2021-11-08T14:55:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=bfbff3703edae789fa5efa9bf174f8e7cff4ded8'/>
<id>urn:sha1:bfbff3703edae789fa5efa9bf174f8e7cff4ded8</id>
<content type='text'>
When closing variables during 'coroutine.close' or 'lua_resetthread',
the status of a coroutine must be set to LUA_OK; a coroutine should
not run with any other status. (See assertion in 'lua_callk'.)

After the reset, the status should be kept as normal, as any error
was already reported.
</content>
</entry>
<entry>
<title>C functions can be tail called, too</title>
<updated>2021-06-14T16:28:21+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2021-06-14T16:28:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=04e19712a5d48b84869f9942836ff8314fb0be8e'/>
<id>urn:sha1:04e19712a5d48b84869f9942836ff8314fb0be8e</id>
<content type='text'>
A tail call to a C function can have the behavior of a "real" tail
call, reusing the stack frame of the caller.
</content>
</entry>
<entry>
<title>Small improvements in hooks</title>
<updated>2021-01-26T19:53:51+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2021-01-26T19:53:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=58aa09a0b91cf81779d6710d7f9d855bb9d3712f'/>
<id>urn:sha1:58aa09a0b91cf81779d6710d7f9d855bb9d3712f</id>
<content type='text'>
- 'L-&gt;top' is set once in 'luaD_hook', instead of being set in
'luaD_hookcall' and 'rethook';

- resume discard arguments when returning after an yield inside a hook
(arguments may interfere with the coroutine stack);

- yield inside a hook asserts it has no arguments.
</content>
</entry>
<entry>
<title>Handles '__close' errors in coroutines in "coroutine style"</title>
<updated>2020-12-30T14:20:22+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2020-12-30T14:20:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=ce101dcaf73ff6d610593230d41b63c163a91519'/>
<id>urn:sha1:ce101dcaf73ff6d610593230d41b63c163a91519</id>
<content type='text'>
Errors in '__close' metamethods in coroutines are handled by the same
logic that handles other errors, through 'recover'.
</content>
</entry>
<entry>
<title>Report last error in closing methods</title>
<updated>2020-12-22T13:54:25+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2020-12-22T13:54:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=0ceada8da92135717d31a3954b5b89a954f9e71a'/>
<id>urn:sha1:0ceada8da92135717d31a3954b5b89a954f9e71a</id>
<content type='text'>
When there are multiple errors around closing methods, report the
last error instead of the original.
</content>
</entry>
<entry>
<title>'coroutine.close'/'lua_resetthread' report original errors</title>
<updated>2020-12-18T14:22:42+00:00</updated>
<author>
<name>Roberto Ierusalimschy</name>
<email>roberto@inf.puc-rio.br</email>
</author>
<published>2020-12-18T14:22:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/lua/commit/?id=409256b7849ec5ab3296cb0ab9eba3d65955d5ea'/>
<id>urn:sha1:409256b7849ec5ab3296cb0ab9eba3d65955d5ea</id>
<content type='text'>
Besides errors in closing methods, 'coroutine.close' and
'lua_resetthread' also consider the original error that stopped the
thread, if any.
</content>
</entry>
</feed>
